Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python. How to solve "setuptools must be installed to install from a source distribution"

I have a Continuous Integration that works with Gitlab. When I deploy, it installs everything in my requirements.txt file with pip. However, when it gets to installing a package named cffi, it throws the error:

Downloading/unpacking cffi==1.10.0 (from -r requirements.txt (line 11)) Cleaning up...

setuptools must be installed to install from a source distribution

I am lost here. Tried adding "setuptools" to requirements.txt and adding a line that explicitly installs it, but it doesn't work.

gitlab.ci looks like this:

script:
        - "cp tests/test_settings.py app/local_settings.py"
        - "source /home/ci/misuper-venv/bin/activate"
        - pip install setuptools
        - "pip install -r requirements.txt"
        - "python manage.py migrate --noinput"

I'm completely lost here. Please help.

like image 620
Alejandro Veintimilla Avatar asked May 17 '17 18:05

Alejandro Veintimilla


1 Answers

It's a known problem.

pip install -U setuptools
pip install -U pip

Just helped me.

Note: a reasonable person would never sudo pip install anything. OS's Python should be managed by the OS's package manager; strong-arming your system Python installation has been many times seen to break your OS in interesting ways.

To pip install anything, use virtualenv or an equivalent.

like image 197
9000 Avatar answered Sep 23 '22 14:09

9000