1

I know this question has been asked and answered a number of times but none of those solutions have worked for me. I have installed Python 2.7 into a local directory and added it to my path. When I try to install numpy i get the following error:

ImportError: No module named setuptools

I cannot simply sudo apt-get install python-setuptools because i don't have root access.

I need to install numpy and ideally have pip working for future applications.

1
  • 1
    Not sure about pip on it's own, but I use Anaconda (Python distribution with Numpy/Scipy, etc.) on my Mac, Linux, and Windows machines. It doesn't require root to install if you use the command line installer and install to your home directory. Commented Dec 12, 2019 at 0:55

2 Answers 2

1

0) Try to install packages that are isolated to the current user, use the --user flag:

pip install --user SomeProject

1a) I agree with @Pi Marillion here, use an isolated conda environment if you don't have root access. This way you keep your path clean.

To install conda:

Since I don't know about your OS, go to https://docs.conda.io/en/latest/miniconda.html

After installation, update your conda (just in case):

conda update conda

To list the installed packages, you can do

conda list

You should see python installed. you can start an interpreter by typing python in the terminal.

There's conda cheat sheet that I found incredibly helpful:

https://docs.conda.io/projects/conda/en/latest/user-guide/cheatsheet.html

b) Now try installing via pip and I think you might need python 3.x for setuptools.

https://packaging.python.org/tutorials/installing-packages/#id13

2) If this does not work you can still try

https://packaging.python.org/guides/installing-stand-alone-command-line-tools/

Hope this helps :)

Sign up to request clarification or add additional context in comments.

Comments

0

First try easy_install --user setuptools pip. If that doesn't work you need to install things manually.

Download setuptools-*.zip from https://pypi.org/project/setuptools/#files. Unzip the archive, cd into the new directory and run python2.7 setup.py install.

Then try pip install. If it still doesn't work reinstall pip: download get-pip.py and run python get-pip.py --user.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.