pip fails in installing package - python

does anyone know what could be wrong here? I am trying to install my own python package, but getting:
c:\Python\Python36\Scripts>pip install --index-url yyy xxx
Looking in indexes: yyy
Collecting xxx
Installing collected packages: xxx
Exception:
Traceback (most recent call last):
File "c:\python\python36\lib\site-packages\pip\_internal\cli\base_command.py",
line 143, in main
status = self.run(options, args)
File "c:\python\python36\lib\site-packages\pip\_internal\commands\install.py",
line 366, in run
use_user_site=options.use_user_site,
File "c:\python\python36\lib\site-packages\pip\_internal\req\__init__.py", lin
e 49, in install_given_reqs
**kwargs
File "c:\python\python36\lib\site-packages\pip\_internal\req\req_install.py",
line 760, in install
use_user_site=use_user_site, pycompile=pycompile,
File "c:\python\python36\lib\site-packages\pip\_internal\req\req_install.py",
line 382, in move_wheel_files
warn_script_location=warn_script_location,
File "c:\python\python36\lib\site-packages\pip\_internal\wheel.py", line 326,
in move_wheel_files
assert info_dir, "%s .dist-info directory not found" % req
AssertionError: xxx .dist-info directory not found
What could be wrong with python or pip and why I am getting:
AssertionError: xxx .dist-info directory not found?

Delete your Pip caches, that's because regardless of whether you use a venv or your system interpreter if you are using Pip as a package manager it always caches parts of the packages in the computer.
To see where the caches are for your OS PyPi Caching.

Related

Pip Error Offline Installation from a Requirements.txt?

I'm trying to install Rasa (it's a python pip package) in a Ubuntu VM that has no internet connection. I use a requirements.txt to install rasa completely offline. The requirements.txt and the packages (.whl files) are in the same folder. I use following command:
pip install --no-index --find-links /home/...(folder with .whl files) -r requirements.txt
It collects the dependencies but stops after the "tensorflow" package. Here's the log:
(venv) [user#ubuntuvm alldependencies]$ pip install --no-index --find-links /home/user/alldependencies/ -r requirements.txt
Looking in links: /home/user/alldependencies/
Processing ./absl_py-0.10.0-py3-none-any.whl
[ PROCESSING bla bla....]
Processing ./tensorboard-2.3.0-py3-none-any.whl
Processing ./tensorboard_plugin_wit-1.7.0-py3-none-any.whl
Processing ./tensorflow-2.3.1-py3-none-any.whl
ERROR: Exception:
Traceback (most recent call last):
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
status = self.run(options, args)
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
return func(self, options, args)
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/commands/install.py", line 324, in run
reqs, check_supported_wheels=not options.target_dir
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 391, in _resolve_one
dist = abstract_dist.get_pkg_resources_distribution()
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/distributions/wheel.py", line 29, in get_pkg_resources_distribution
with ZipFile(self.req.local_file_path, allowZip64=True) as z:
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/zipfile.py", line 1108, in __init__
self._RealGetContents()
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/zipfile.py", line 1175, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
What can I do? I installed Python 3.6 and the newest Pip Version (20.x).
Looks like the tensorflow-2.3.1-py3-none-any.whl is corrupted. Possible causes are: something went wrong during the download or during the write on disk of this file. Most likely downloading it again would solve the issue.

".dist-info directory not found" with pipenv install -r requirements.txt

I'm trying to install snapcraft's requirements using:
pipenv install -r snapcraft/requirements.txt
and it fails to install those two dependencies:
https://launchpad.net/ubuntu/+archive/primary/+files/python-apt_1.1.0~beta1build1.tar.xz
https://launchpad.net/python-distutils-extra/trunk/2.39/+download/python-distutils-extra-2.39.tar.gz
Collecting f3a5fdd from https://launchpad.net/ubuntu/+archive/primary/+files/python-apt_1.1.0~beta1build1.tar.xz#egg=f3a5fdd
Installing collected packages: f3a5fdd
Exception:
Traceback (most recent call last):
File "/media/fgervais/core/.venv/lib/python3.5/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/media/fgervais/core/.venv/lib/python3.5/site-packages/pip/_internal/commands/install.py", line 335, in run
use_user_site=options.use_user_site,
File "/media/fgervais/core/.venv/lib/python3.5/site-packages/pip/_internal/req/__init__.py", line 49, in install_given_reqs
**kwargs
File "/media/fgervais/core/.venv/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 748, in install
use_user_site=use_user_site, pycompile=pycompile,
File "/media/fgervais/core/.venv/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 961, in move_wheel_files
warn_script_location=warn_script_location,
File "/media/fgervais/core/.venv/lib/python3.5/site-packages/pip/_internal/wheel.py", line 316, in move_wheel_files
assert info_dir, "%s .dist-info directory not found" % req
AssertionError: f3a5fdd .dist-info directory not found
Any body know where #egg=f3a5fdd is coming from?
I think this is what cause the issue because this works:
pipenv shell
pip3 install https://launchpad.net/ubuntu/+archive/primary/+files/python-apt_1.1.0~beta1build1.tar.xz
but if I add #egg=f3a5fdd it fails with the same error as pipenv.

Attribute Error Installing with pip

This is a head stumper so I am posting this question AFTER having examined and read all of the prior posts on this issue.
Running OSX 10.9 Python 2.7 no virtualenv
pip install awssh
Downloading/unpacking awssh
Downloading awssh-0.1.tar.gz
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py",
line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py",
line 274, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 1215, in prepare_files
req_to_install.run_egg_info()
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 288, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 265, in setup_py
import setuptools
File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extension import Extension
File "/Library/Python/2.7/site-packages/setuptools/extension.py", line 8, in <module>
File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 21, in <module>
packaging = pkg_resources.packaging
AttributeError: 'module' object has no attribute 'packaging'
This error is caused by the presence of an outdated version of pkg_resources. In order to get rid of the error, do the following:
Start a python session, import pkg_resources, and view the file from which it is loaded:
In [1]: import pkg_resources
In [2]: pkg_resources.__file__
Out[2]: '/usr/lib/python2.7/dist-packages/pkg_resources.pyc'
Remove this file (and the associated *.py file):
$ sudo rm /usr/lib/python2.7/dist-packages/pkg_resources.py*
That's it! Re-run the installation; it should complete without any errors:
$ sudo pip install awssh
Warning
If you're on a Debian based Linux system, this file might have been installed via the python-pkg-resources package. Therefore updating or reinstalling this package will reinstate the stale module! Also be aware that you're messing with a file which is supposed to be controlled by apt.

Python Pip Install "Egg" Error (Pandas and other modules)

Having issues installing some python modules (for example pandas) and also had some issues installing ipython notebook.
This error seems to have come up before for other folks (Python pip install fails: invalid command egg_info), but they were using Python 2.7, whereas I'm using 2.6 (default with my Mac OS 10.6). Also I tried easy_install -U setuptools and pip install --upgrade setuptools but neither worked.
This is the error I get for installing pandas:
Command python setup.py egg_info failed with error code 1 in /private/var/folders/Wm/WmmbYincEnuCrAMtGBudAk+++TM/-Tmp-/pip_build_AWal/pandas
Storing debug log for failure in /Users/AWal/Library/Logs/pip.log
For installing iPython, this is the error that I get:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/wheel.py", line 341, in move_wheel_files
generated.extend(maker.make_multiple(['%s = %s' % kv for kv in console.items()]))
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 316, in make_multiple
filenames.extend(self.make(specification, options))
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 305, in make
self._make_script(entry, filenames, options=options)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 209, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 189, in _write_script
self._fileop.write_binary_file(outname, script_bytes)
File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/util.py", line 384, in write_binary_file
with open(path, 'wb') as f:
IOError: [Errno 13] Permission denied: '/usr/local/bin/sphinx-apidoc'
Storing debug log for failure in /Users/AWal/Library/Logs/pip.log
Any thoughts on what to do?
UPDATE:
When I do sudo pip install pandas (another module that I can't install), I get a long long traceback with the end error message:
RuntimeError: Broken toolchain: cannot link a simple C program
And traceback (a sample of it of the 100 or so lines) looks like this:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/pandas/setup.py", line 619, in <module>
**setuptools_kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 113, in setup
File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 266, in __init__
File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 312, in fetch_build_eggs
File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 753, in resolve
File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1005, in best_match
File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1017, in obtain
File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 379, in fetch_build_egg
File "build/bdist.macosx-10.6-universal/egg/setuptools/command/easy_install.py", line 619, in easy_install
A permission Denied message would suggest you to run your command as root as suggested by Hackaholic.
try sudo pip install YOUR_PACKAGE
You might also want to have a look at virtualenv to use a more isolated environment.
Under debian based distributions, you might install python-virtualenv package with apt-get install python-virtualenv.
Then create a virtual environment names whatever by typing virtualenv whatever (this will create a folder whatever inside your current folder.
Then cd to it and type bin/activate to enter this virtual environment.
From there try again your pip install command.
Might help
UPDATE :
You might try to use the suggested solutions available here
To sumup, try to add export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future inside ~/.bash_profile
This question comes first in Google, but the second one actually worked:
pip install -U setuptools
pip install ez_setup

How to fix error “Expected version spec in …” using pip install on Windows?

On a Windows 7 machine I am using the following command to install a package from a local directory:
pip install addons/pnc_tests --upgrade --extra-index-url=http://some_server/simple
which results in the following error:
C:\Users\alex\PNC\tas\ENV\Scripts\pip-script.py run on 07/16/14 07:50:47
Exception:
Traceback (most recent call last):
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\commands\install.py", line 258, in run
InstallRequirement.from_line(name, None))
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\req.py", line 173, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\req.py", line 71, in __init__
req = pkg_resources.Requirement.parse(req)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2667, in parse
reqs = list(parse_requirements(s))
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2605, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2573, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'addons/pnc_tests', 'at', '/pnc_tests')
How to solve this problem?
I guess you are missing the parameter -r;
It must be like this if you have a requirement file to install from;
pip install -r addons/pnc_tests --upgrade --extra-index-url=http://some_server/simple
As it is defined on;
Pip Documentation
One need to replace the slash (/) by a backslash (\):
pip install addons\pnc_tests --upgrade --extra-index-url=http://some_server/simple
On my system I had just specified the wrong directory. Double check your folder names. x_x

Categories