Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to install cryptography==3.4.7 in venv in python

I am trying to install several python packages in non-internet machine. Getting error as

Could not find a version that satisfies the requirement cryptography==3.4.7 (from -r requirements.txt (line 14)) (from versions: )
No matching distribution found for cryptography==3.4.7 (from -r requirements.txt (line 14))

I downloaded all the packages in online system and moved requirements.txt and downloaded packages folder to offline system and trying to install packages there with below command,

pip3.6 install --no-index --find-links="./tranferred_packages" -r requirements.txt

Steps I followed -

  1. Installed virtualenv online with pip:
pip install virtualenv --user

  1. Created virtualenv and source it
python -m virtualenv myenv
cd myenv 
source bin/activate
  1. Installed packages using
pip3 install pkgname
  1. then did
pip freeze > requirements.txt
  1. downloaded pkgs to one folder using
pip download -r requirements.txt
  1. moved requirements.txt and downloaded pkgs folder to offline system and trying to install pkgs over there using
pip install --no-index --find-links="./tranferred_packages" -r requirements.txt

The detail error is

Collecting cryptography==3.4.7 (from -r requirements.txt (line 14))
  0 location(s) to search for versions of cryptography:
  Could not find a version that satisfies the requirement cryptography==3.4.7 (from -r requirements.txt (line 14)) (from versions: )
Cleaning up...
  Removing source in /tmp/pip-build-beg7uvpz/aws-requests-auth
  Removing source in /tmp/pip-build-beg7uvpz/blist
  Removing source in /tmp/pip-build-beg7uvpz/chardet2
No matching distribution found for cryptography==3.4.7 (from -r requirements.txt (line 14))
Exception information:
Traceback (most recent call last):
  File "/root/venv/lib64/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/root/venv/lib64/python3.6/site-packages/pip/commands/install.py", line 346, in run
    requirement_set.prepare_files(finder)
  File "/root/venv/lib64/python3.6/site-packages/pip/req/req_set.py", line 381, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/root/venv/lib64/python3.6/site-packages/pip/req/req_set.py", line 557, in _prepare_file
    require_hashes
  File "/root/venv/lib64/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/root/venv/lib64/python3.6/site-packages/pip/index.py", line 514, in find_requirement
    'No matching distribution found for %s' % req
pip.exceptions.DistributionNotFound: No matching distribution found for cryptography==3.4.7 (from -r requirements.txt (line 14))

I have cryptography mentioned in requirements.txt and cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl present in tranferred_packages folder.

cat requirements.txt | grep cryptography
cryptography==3.4.7

(venv) [root@ip-172-35-10-19 venv]# ls -l tranferred_packages/cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl 
-rwxr-xr-x. 1 root root 3181242 Apr 27 15:05 tranferred_packages/cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl
(venv) [root@ip-172-35-10-19 venv]# 

Output of other packages where its not giving error,

Collecting certifi==2020.4.5.1 (from -r requirements.txt (line 7))
  0 location(s) to search for versions of certifi:
  Found link file:///root/venv/tranferred_packages/certifi-2020.4.5.1-py2.py3-none-any.whl, version: 2020.4.5.1
  Local files found: /root/venv/tranferred_packages/certifi-2020.4.5.1-py2.py3-none-any.whl
  Using version 2020.4.5.1 (newest of versions: 2020.4.5.1)

I am able to install the same when created virtualenv but not when creating venv.

Created virtualenv using below command,

pip3 install virtualenv --user

Output of pip3 list

# pip3 list |grep cryptography
cryptography          3.4.7

In this virtualenv, python and pip version is,

python                    python2.7                 python3.6                 python3.6m                python3.6m-x86_64-config  
python2                   python3                   python3.6-config          python3.6m-config         python3-config       

# python -V
Python 3.6.8

# python3.6 -V
Python 3.6.8

pip      pip3     pip-3    pip-3.6  pip3.6

# pip-3.6  -V
pip 21.0.1 from /root/oldenv/lib/python3.6/site-packages/pip (python 3.6)

all above pip shows version as pip 21.0.1 except for pip-3 which shows version as,

pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Below three modules were installed by default after creating virtualenv

pip 21.0.1
setuptools 56.0.0
wheel 0.34.2

Created venv using below command,

# python3.6 -m venv devenv 

Below two modules are installed by default after creating venv,

pip (9.0.3)
setuptools (39.2.0)

System wide python and pip version

python                    python2.7                 python3.6                 python3.6m                python3.6m-x86_64-config  
python2                   python3                   python3.6-config          python3.6m-config         python3-config 

# python --version
Python 2.7.5

# python3.6 --version
Python 3.6.8


pip3     pip-3    pip-3.6  pip3.6

# pip3.6  -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Other details -

RHEL 7.8 (Maipo)
Kernel - 3.10.0-1127.el7.x86_64

Can someone say what is causing issue?

Thanks,

like image 314
prat Avatar asked Sep 02 '25 01:09

prat


1 Answers

Issue is solved after upgrading from pip-9.0.3 to pip-21.1 (pip-21.1-py3-none-any.whl) using python3 -m pip install --upgrade pip-21.1-py3-none-any.whl command.

like image 148
prat Avatar answered Sep 04 '25 15:09

prat