Pip Error Offline Installation from a Requirements.txt? - python

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.

Related

pip install whl file off-line without network

I am trying to install off line the python pkgs - argparse-1.4.0-py2.py3-none-any.whl as the following
pip install --ignore-installed --no-index --find-links /pkgs/argparse-1.4.0-py2.py3-none-any.whl
Ignoring indexes: https://pypi.python.org/simple
You must give at least one requirement to install (maybe you meant "pip install /pkgs/argparse-1.4.0-py2.py3-none-any.whl"?)
but the installation failed on - Ignoring indexes: https://pypi.python.org/simpleIgnoring
what is the right way to install off-line ( without network internet ) the whl file - argparse-1.4.0-py2.py3-none-any.whl
we run the pip on rhel 7.x machines with python 2.7
we also tried the following but other error appears and without success
pip install --ignore-installed --no-index --find-links /pkgs argparse-1.4.0-py2.py3-none-any.whl
seems that the direction to the right syntax is
pip install --use-wheel --no-index --find-links="/pkgs" "argparse-1.4.0-py2.py3-none-any.whl"
but when I add the flag --ignore-installed as
pip install --ignore-installed --use-wheel --no-index --find-links="/pkgs" "argparse-1.4.0-py2.py3-none-any.whl"
then we get
exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 299, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 587, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/download.py", line 798, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/download.py", line 705, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 482, in unzip_file
zipfp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: '/pkgs/argparse-1.4.0-py2.py3-none-any.whl'
is there any reason you need to ignore installed.
I don't know the exactly what causes the problem, but pip cannot see the file you are trying to install
some things that could be wrong:
Did you look if the file still exist after
pip install --use-wheel --no-index --find-links="/pkgs" "argparse-1.4.0-py2.py3 none-any.whl"
and it can be accessed by a command without root privilege.
Another reason for your problem could be that
--ignore-installed
forces pip to not use the file

How do I fix this error (unable to find resource t32.exe) that I get when I try to upgrade pip on Windows 10?

I am getting the following error:
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\commands\install.py", line 395, in run
installed = install_given_reqs(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\__init__.py", line 67, in install_given_reqs
requirement.install(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\req\req_install.py", line 809, in install
install_wheel(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 607, in install_wheel
install_unpacked_wheel(
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 548, in install_unpacked_wheel
generated_console_scripts = maker.make_multiple(scripts_to_generate)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 415, in make_multiple
filenames.extend(self.make(specification, options))
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\install\wheel.py", line 280, in make
return super(PipScriptMaker, self).make(specification, options)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 404, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 304, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 239, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib\scripts.py", line 383, in _get_launcher
raise ValueError(msg)
ValueError: Unable to find resource t32.exe in package pip._vendor.distlib
Please take a look!
This one worked perfectly for me without any additional installations or 3rd party scripts:
python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip
TRY THIS:
uninstall current pip:
python -m pip uninstall pip setuptools
download get-pip.py from https://bootstrap.pypa.io/get-pip.py
execute get-pip script:
python get-pip.py
Don't forget to mark answer correct if you find it helpful.
Thanks
This worked for me. I visited this page and searched for the missing resource "t32.exe".
Scroll down the page and complete the capture, and click on download. t32.exe file download.
Before you download, make sure your antivirus is on to avoid any problems after the download.
After downloading, go to the directory
C:\Users\CR1008tu\AppData\Roaming\Python\Python38\site-packages\pip_vendor\distlib\
Now copy and paste the downloaded t32.exe file and paste it into the directory and save it. Now run python -m pip install -–upgrade pip again.

pip errors No files/directories in /tmp/

I am getting No files/directories in /tmp/* errors while I try to install any package on my Ubuntu 18.04.2 LTS/ Python 3.6.8 / Python 2.7.15+ machine.
For instance,
pip install pyx
Collecting pyx
Using cached https://files.pythonhosted.org/packages/f7/25/59c136568c1b61ee087155c874fcd9f7196a943a6a5ee3429efeb30ea2a8/PyX-0.15.tar.gz
No files/directories in /tmp/pip-build-nRurCC/pyx/pip-egg-info (from PKG-INFO)
This happens for every package I am trying to install.
sudo is not helping.
Solution presented here, using --no-cache-dir option, is not helping.
Output of running the pip install command with vvv option gives the following output.
No files/directories in /tmp/pip-build-VU1cex/pyx/pip-egg-info (from PKG-INFO)
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 342, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 455, in run_egg_info
metadata_name = canonicalize_name(self.pkg_info()["Name"])
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 533, in pkg_info
data = self.egg_info_data('PKG-INFO')
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 471, in egg_info_data
filename = self.egg_info_path(filename)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 515, in egg_info_path
'No files/directories in %s (from %s)' % (base, filename)
InstallationError: No files/directories in /tmp/pip-build-VU1cex/pyx/pip-egg-info (from PKG-INFO)
I think it is an upstream issue I tried multiple things even installing using the latest commit pip install git+https://github.com/pyx-project/pyx.git#fc66c078727b02693b122ad346b9fa5472e06eb7, please try this version: pip install PyX==0.12 it should work.
If using pip 6.0 or newer, check if it works with the --no-cache-dir option.
You can also try to get a detailed output from pip using the -vvv argument
Source: https://stackoverflow.com/a/9510610/2542835
Apparently pip3 install x works for me. pip install x does not.

".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.

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

Categories