I want to install a python-package (celery) within a virtualenv using pip. My virtualenv is activated, and after executing

pip install celery

the directory venv/lib/python3.6/site-packages/ has been created. However, when I try to execute celery, I get an error message saying it is not installed, and it doesn't exist in venv/bin/, while it does exist on my Arch Linux installation where I (probably :O) did the same thing... Any hints?

  • sudo -H pip install celery ? – cmak.fr Jun 6 '18 at 16:19

Usually you pip install anything either with sudo systemwide:

sudo pip install celery

or with --user locally in home directory:

pip install --user celery
  • Will try it with sudo tomorrow, but since I am in a virtualenv, shouldn't pip install install it "systemwide" in my virtualenv without requiring sudo since it is all within my venv? – Gasp0de Jun 6 '18 at 22:27
  • Here is a nice explanation how to use pip in virtualenv. Apparently you will need to make sure that you use the correct python version with it. To use the versions of python and pip inside the environment, type env/bin/python and env/bin/pip respectively. – Ivan Kovtun Jun 7 '18 at 0:02
  • 1
    Thanks for the tips, however, what I was doing is exactly what you describe. Instead of using env/bin/python, I activated the virtualenv (as described in your link) and within the virtualenv I can install it using pip install celery without sudo. It had something to do with the python version I was using, I forced virtualenv to use a custom built python3.6. With the python 3.5 that ships with ubuntu it works... – Gasp0de Jun 7 '18 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.