0

I'm attempting to use click within a Python 3 virtualenv (3.9.5) script and I keep getting an import error even after installing it via pip. When I attempt to install it again it says requirement already satisfied. I feel like I'm missing something simple.

enter image description here

Heats
  • 123
  • 1
  • 3
  • 10
  • Try uninstalling it and installing it again. Also make sure that your site-packages file in Python39 is going through your system path. – ColeTMK Jun 23 '21 at 03:08
  • 2
    pip seems to be not be installing to the virtualenv, and it is installing to the system packages. Try recreating your venv, or look at https://serverfault.com/questions/526594/pip-not-installing-to-virtualenv-directory. – KetZoomer Jun 23 '21 at 03:09
  • Ensure that `pip` that is being executed is in fact from the current virtualenv by running `which pip`, you may find that it is not in fact inside the `click` venv. To be sure that you are running the same `pip` with the currently activated `python`, run `python -m pip` instead. Since you are on OS X, [this thread](https://stackoverflow.com/questions/20952797/pip-installing-in-global-site-packages-instead-of-virtualenv/20954767) may be rather relevant. – metatoaster Jun 23 '21 at 03:12
  • @KetZoomer it looks like it is not installing inside of the virtualenv like you said. I attempted to recreate the virtualenv and I'm running into the same thing. I took a look at the article you posted and I saw step 3 "To get pip working, you must correct the python interpreter in the pip file, this as well has a static interpreter location set by virtualenv in the creation process." but no steps on how to do that. – Heats Jun 23 '21 at 03:36
  • It may be useful to check the output of `which pip` and `which python`, and provide that output with your question. – metatoaster Jun 23 '21 at 07:44

2 Answers2

1

Although you are using virutalenv but just in case, make sure you are using the same version of python where click is installed, to run your script. try to do a pip freeze or pip list to check all the modules installed, do it with and without the virtualenv activated. sometimes a simple restart of the cmd prompt can solve the issue. These kinds of problems are common in windows

Snawar
  • 61
  • 3
-1

Not sure but I think you should try again by changing name of virtual envirment. Because you have used same name for virtual envirment.