I'm trying to pip install geopandas as a fresh installation, so I want to remove existing packages like GDAL and fiona. I've already managed to pip uninstall fiona, but when I try to uninstall or reinstall GDAL it gives the following error message:
(base) C:\usr>pip install C:/usr/Anaconda3/Lib/site-packages/GDAL-3.4.1-cp38-cp38-win_amd64.whl
Processing c:\usr\anaconda3\lib\site-packages\gdal-3.4.1-cp38-cp38-win_amd64.whl
Installing collected packages: GDAL
Attempting uninstall: GDAL
Found existing installation: GDAL 3.0.2
ERROR: Exception:
Traceback (most recent call last):
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
return func(self, options, args)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 405, in run
installed = install_given_reqs(
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\__init__.py", line 68, in install_given_reqs
uninstalled_pathset = requirement.uninstall(auto_confirm=True)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 637, in uninstall
uninstalled_pathset = UninstallPathSet.from_dist(dist)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 554, in from_dist
for script in dist.iterdir("scripts"):
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\metadata\pkg_resources.py", line 156, in iterdir
if not self._dist.isdir(name):
File "C:\usr\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2816, in __getattr__
return getattr(self._provider, attr)
AttributeError: 'PathMetadata' object has no attribute 'isdir'
Does anyone know why GDAL cannot be uninstalled?
I just came across this question after getting the same error. Coincidentally I had just upgraded pip (I was getting tired of the yellow warnings).
All I had was to down grade my pip
pip install pip==21.3.1 --user
I was seeing the same AttributeError as you when trying to install google-cloud-firestore. My solution was to upgrade my version of pip. In my case, I upgraded to pip from 22.0.2 to 22.3.1
pip install --upgrade pip
Related
I'm still a novice to all the advanced parts of coding. i have the 3.9.11 version of python installed. Whenever i install Pygames, I always get this result below. Any way that i could resolve this? thanks!
C:\\Users\\username\>pip install pygame==2.0.0.dev14
Collecting pygame==2.0.0.dev14
Downloading https://files.pythonhosted.org/packages/4e/f6/9031970fbd0cabb02842a68b6bd2defc55f4c1409e76712dd32c4d6e46cf/pygame-2.0.0.dev14.tar.gz (5.6MB)
100% |################################| 5.6MB 74kB/s
c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_\_.py:18: UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.
"Distutils was imported before Setuptools, but importing Setuptools "
c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_\_.py:30: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Exception:
Traceback (most recent call last):
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\basecommand.py", line 211, in main
status = self.run(options, args)
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\commands\\install.py", line 294, in run
requirement_set.prepare_files(finder)
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 334, in prepare_files
functools.partial(self.\_prepare_file, finder))
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 321, in \_walk_req_to_install
more_reqs = handler(req_to_install)
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 505, in _prepare_file_
abstract_dist.prep_for_dist()
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 123, in prep_for_dist
self.req_to_install.run_egg_info()
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_install.py", line 376, in run_egg_info
self.setup_py, self.name,
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_install.py", line 347, in setup_py
import setuptools # noqa
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\setuptools\__init_.py", line 8, in \<module\>
import _distutils_hack.override # noqa: F401_
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\\override.py", line 1, in \<module\>
__import__('_distutils_hack').do_override()_
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_.py", line 72, in do_override
ensure_local_distutils()
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_.py", line 59, in ensure_local_distutils
assert '\_distutils' in core.__file__, core.__file__
AssertionError: c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\distutils\\core.py
You are using pip version 7.1.2, however version 22.0.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
First things first, upgrade your pip putting this in your cmd: python -m pip install --upgrade pip. Why are you installing lower version of pygame? Also if you don't have a specific reason to use python 3.9, you can install python 3.10. If that doesn't work, try reinstalling python so it reinstalls the pip and then try again.
For some reason I can't install anything with pip/pip3 lately. For example, when I try to install mendeley using the command "pip install mendeley", the following error message appears:
Traceback (most recent call last):
File "/Users/u1790509/anaconda3/bin/pip", line 11, in <module>
load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 480, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2691, in load_entry_point
return ep.load()
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2322, in load
return self.resolve()
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2328, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
ImportError: cannot import name 'FormatControl'
The same error appears whenever I attempt to install packages using pip. Does anyone have any suggestion for fixing it?
thanks,
Stephen
I was having this issue on systems running older versions of Anaconda and Python. Downgrading pip as per this answer and then upgrading it worked for me.
I ran:
conda install pip==9.0.3
pip install --upgrade pip
Then I was able to install the package I wanted to via pip install ....
I'm not sure what's going on behind the scenes since after downgrading from 10.x to 9.0.3, I still got:
Successfully uninstalled pip-20.0.2
Successfully installed pip-20.3.4
Probably a result of mixing Anaconda and pip for package management, but works for now for legacy purposes.
problem: I can't run "tensorboard --logdir=summaries" in my terminal because I get this error
system: macbook pro running Catalina
environment: running pyenv with python3 as global
package: I have tensorflow 2.2.0 installed via pip
I have setuptools 49.1.0
Traceback (most recent call last):
File "/usr/local/bin/tensorboard", line 10, in
sys.exit(run_main())
File "/Library/Python/3.7/site-packages/tensorboard/main.py", line 65, in run_main
default.get_plugins() + default.get_dynamic_plugins(),
File "/Library/Python/3.7/site-packages/tensorboard/default.py", line 125, in get_dynamic_plugins
"tensorboard_plugins"
File "/Library/Python/3.7/site-packages/tensorboard/default.py", line 124, in
for entry_point in pkg_resources.iter_entry_points(
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2410, in load
self.require(*args, **kwargs)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2433, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (setuptools 40.8.0 (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages), Requirement.parse('setuptools>=41.0.0'))
the setuptools version you have is 40.8.0.
tensorboard needs setuptools>=41.0.0.
So there are two solutions:
update setuptools to >=41.0.0
create a new environment with setuptools>=41.0.0.
MacOs may not allow you to update setuptools, due to system integrity protection
Adding --user python to the command allowed this to work.
In other words
pip install --upgrade setuptools --user python
As it turns out I was not using Pyenv correctly. Once I used "pyenv global system" then I was able to update the pip packages correctly and the right setuptools was installed and TensorBoard ran as expected
When is try to install scikit learn, im getting this error,
I used "pip install -U scikit-learn[alldeps]"
"""Collecting scikit-learn[alldeps]
Using cached scikit_learn-0.18.1-cp27-cp27mu-manylinux1_x86_64.whl
Requirement already up-to-date: numpy>=1.6.1; extra == "alldeps" in /usr/local/lib/python2.7/dist-packages (from scikit-learn[alldeps])
Collecting scipy>=0.9; extra == "alldeps" (from scikit-learn[alldeps])
Using cached scipy-0.19.0-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: scipy, scikit-learn
Found existing installation: scipy 0.17.0
DEPRECATION: Uninstalling a distutils installed project (scipy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling scipy-0.17.0:
Exception:
Traceback (most recent call last):
File "/home/suba/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/suba/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/suba/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/home/suba/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/home/suba/.local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/home/suba/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/dist-packages/scipy-0.17.0.egg-info' """
How can i fix this error?
Permission error.
sudo pip install -U scikit-learn[alldeps] could help.
There's a permission error. Are you using root permissions to install? If not, please use same command prefixed with 'sudo' and provide password when asked.
After installing ipython on Windows via pip install ipython, I am unable to run it and receive the following error.
> ipython
Traceback (most recent call last):
File "C:\Python27\scripts\ipython-script.py", line 5, in <module>
from pkg_resources import load_entry_point
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2607, in <module>
parse_requirements(__requires__), Environment()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pyreadline>=1.7.1
pyreadline was installed when ipython was via pip, but pip freeze shows warnings about the SVN location
> pip freeze
Warning: cannot find svn location for pyreadline==1.7.1.dev-r0
...
ipython==0.13.1
## FIXME: could not find svn URL in dependency_links for this package:
pyreadline==1.7.1.dev-r0
...
The solution was to uninstall the version of pyreadline pulled when ipython was installed (pip uninstall pyreadline) and download and install pyreadline-1.7.1.win32-py2.7.exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyreadline