bench icon indicating copy to clipboard operation
bench copied to clipboard

Cryptography failed to install - Upstream issue - Need changes to script

Open f-9t9it opened this issue 4 years ago • 3 comments

Issue: Easy Install This is the second time I am getting this issue, First time we solved it with rustup from snap which was day before yesterday and now I am trying to install a new server and facing the exact same issue. First was local server and second is cloud server which is our regular vps.

Do the checklist before filing an issue:

  • [X] Did you retain the logfile (path of logfile is shared while the script is run)? We definitely need the logfile to debug any easy install related issues.
  • [ ] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome

Distro Details:

  1. Linux XXX.contaboserver.net 4.15.0-135-generic #139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

**Command Run ** sudo python3 install.py --production --version 11 --user {username}

curl already installed!
wget already installed!
git already installed!
Installing pip3...
pip3 installed!
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mkc4za5g/cryptography/
Traceback (most recent call last):
  File "install.py", line 484, in <module>
    install_prerequisites()
  File "install.py", line 174, in install_prerequisites
    'python3': "sudo -H python3 -m pip install --upgrade setuptools wheel cryptography ansible~=2.8.15 pip"
  File "install.py", line 141, in run_os_command
    returncode = subprocess.check_call(command, shell=True, stdout=log_stream, stderr=sys.stderr)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'sudo -H python3 -m pip install --upgrade setuptools wheel cryptography ansible~=2.8.15 pip' returned non-zero exit status 1.
       =============================DEBUG ASSISTANCE=============================
    
    error: Can not find Rust compiler
    
    ----------------------------------------
  Can't rollback cryptography, nothing uninstalled.
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-arr9bj8n/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-tdc_7_z2-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-arr9bj8n/cryptography/

Log File Output:

Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/15/0e/255e3d57965f318973e417d5b7034223f1223de500d91b945ddfaef42a37/setuptools-53.0.0-py3-none-any.whl (784kB)
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Collecting cryptography
  Downloading https://files.pythonhosted.org/packages/f8/04/51dc8a4ccb37b69a4e165a94837f70653b0b6ca49a6346361062b1f6bb09/cryptography-3.4.3.tar.gz (545kB)
    Complete output from command python setup.py egg_info:
    
            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install cryptography:
    
            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-mkc4za5g/cryptography/setup.py", line 14, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'
    
    ----------------------------------------
Install script run at 21:02 on 2021-02-09

Solution: New cryptohraphy needs setuptools_rust instead of setuptools Install rustup using snap and then install cryptography as cryptography installation fails

sudo apt-get install build-essential libssl-dev libffi-dev cargo
sudo apt install snapd
sudo snap install rustup --classic
sudo rustup default stable

Then continue the easy install script. This had worked the first time but this is just a work around, not an actual fix.

f-9t9it avatar Feb 09 '21 21:02 f-9t9it

For those having this issue, you just need to upgrade pip as shown in the fix : pip3 install --upgrade pip

MoeNadal avatar Mar 20 '21 19:03 MoeNadal

the above two solutions didn't worked for me , any breakthrough in this ?

aman-greycube avatar Apr 19 '21 04:04 aman-greycube

Redis service will fail to start if IPv6 is disabled on your server.

Login with root

$ enable_ipv6
$ shutdown -r now

ashish-greycube avatar Apr 20 '21 10:04 ashish-greycube