1

I'm trying to add social authentication in my project but when I try to install django-allauth it is giving me error I've tried this post but no luck it's giving me another error related to setuptools_rust I've given commands I've tried and errors related to each command.

$ pip3 install django-allauth

Error :

Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-7e3fgl32/cryptography/setup.py", line 14, in from setuptools_rust import RustExtension ModuleNotFoundError: No module named 'setuptools_rust'

        =============================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==========================


---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in

/tmp/pip-build-7e3fgl32/cryptography/ Then I tried to install setuptools_rust as it causing error

$ pip3 install setuptools_rust

This package does not give me any error it installed successfully Then I've tried to install some commands from this post

$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev

It did not change anything check response of command

Reading package lists...
Done Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
libffi-dev is already the newest version(3.2.1-8).
python-dev is already the newest version (2.7.15~rc1-1).
libssl-dev is already the newest version (1.1.1-1ubuntu2.1~18.04.14).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

and finally I've tried this command

$ pip3 install cryptography

Error :

Collecting cryptography
  Using cached https://files.pythonhosted.org/packages/f9/4b/1cf8e281f7ae4046a59e5e39dd7471d46db9f61bb564fddbff9084c4334f/cryptography-36.0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/tmp/pip-build-yp90u93b/cryptography/setup.py", line 54, in <module>
        rust_version=">=1.41.0",
      File "/home/dev/Ankit/new/afterlife_env/lib/python3.6/site-packages/setuptools/__init__.py", line 152, in setup
        _install_setup_requires(attrs)
      File "/home/dev/Ankit/new/afterlife_env/lib/python3.6/site-packages/setuptools/__init__.py", line 142, in _install_setup_requires
        dist = MinimalDistribution(attrs)
      File "/home/dev/Ankit/new/afterlife_env/lib/python3.6/site-packages/setuptools/__init__.py", line 134, in __init__
        distutils.core.Distribution.__init__(self, filtered)
      File "/home/dev/Ankit/new/afterlife_env/lib/python3.6/site-packages/setuptools/dist.py", line 457, in __init__
        for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
    AttributeError: module 'pkg_resources' has no attribute 'iter_entry_points'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/pip-build-yp90u93b/cryptography/setup.py", line 88, in <module>
        version = pkg_resources.get_distribution(dist).version
    AttributeError: module 'pkg_resources' has no attribute 'get_distribution'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-yp90u93b/cryptography/setup.py", line 89, in <module>
        except pkg_resources.DistributionNotFound:
    AttributeError: module 'pkg_resources' has no attribute 'DistributionNotFound'
    
        =============================DEBUG ASSISTANCE=============================
        If you are seeing a compilation error please try the following steps to
        successfully install cryptography:
        1) 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
        2) Read https://cryptography.io/en/latest/installation/ for specific
           instructions for your platform.
        3) Check our frequently asked questions for more information:
           https://cryptography.io/en/latest/faq/
        4) Ensure you have a recent Rust toolchain installed:
           https://cryptography.io/en/latest/installation/#rust
    
        Python: 3.6.9
        platform: Linux-4.15.0-166-generic-x86_64-with-Ubuntu-18.04-bionic
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-yp90u93b/cryptography/
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ankit Tiwari
  • 4,438
  • 4
  • 14
  • 41

1 Answers1

0

It seems pip3 install --upgrade pip not worked for me then I tried this way and it worked

python3 -m pip install --upgrade pip

Thanks to this post

  • for Python 3:

    python3 -m pip install --upgrade pip
    
  • for Python 2:

    python2 -m pip install --upgrade pip
    
  • for Python:

    python -m pip install --upgrade pip
    
Ankit Tiwari
  • 4,438
  • 4
  • 14
  • 41
  • 1
    The answer Seems good. – Sunderam Dubey May 28 '22 at 01:28
  • Unfortunately simply upgrading pip doesnt solve any issue. I have the same problem, django-allauth doesnt install and get stuck at `Building wheels for collected packages: cryptography Building wheel for cryptography (pyproject.toml) ... ` – Stefano Tuveri Nov 10 '22 at 20:48
  • Hello @StefanoTuveri then try to install wheel if it's still not woking then reading this [answer](https://stackoverflow.com/a/56504270/14457833) may help you. – Ankit Tiwari Nov 11 '22 at 05:37
  • 1
    @AnkitTiwari actually the solution was way easier. i just needed to specify which version i wanted as `pip3 install django-allauth==version`. I frankly have no clue why that worked by it did and i trid in a parallel project with the same issues. When you try to compile or install without version it loops and goes no where. Just to be clear i tested this multiple time – Stefano Tuveri Dec 01 '22 at 18:28