pythonpath

Pip installs packages in the wrong directory

Pip installs packages in the wrong directory Question: So I want to install the opencv-python package. I typed in pip install opencv-python and got this: Collecting opencv-python Downloading opencv_python-4.7.0.72-cp37-abi3-win_amd64.whl (38.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.2/38.2 MB 3.1 MB/s eta 0:00:00 Requirement already satisfied: numpy>=1.17.0 in c:usersleo westerburg burrappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packages (from opencv-python) (1.24.2) Installing collected packages: opencv-python Successfully installed …

Total answers: 2

Python subprocess can't find Pythonpath module

Python subprocess can't find Pythonpath module Question: I am trying to use subprocess.run([‘python3.9’, "scripts/example.py"], check=True). example.py uses a module, that I have added to the PYTHONPATH. However, whenever I run the above line, the module is not found. The confusing part for me is, that printing sys.path inside of example.py I do see the path …

Total answers: 1

PYTHONPATH works in interactive mode but fails in script

PYTHONPATH works in interactive mode but fails in script Question: Problem I’ve been trying to run a python script which imports from the Foundation package: from Foundation import … Whenever I try to run this I get the following error: Things I’ve done: I’ve installed the Foundation package and verified that it was installed in …

Total answers: 1

add a python path to a module in visual studio code

add a python path to a module in visual studio code Question: I’m having difficulty specifying python path containing modules/packages in another directory or even folder of the same project. When I try to import I get the error: ModuleNotFoundError: No module named ‘perception’ In Spyder this is simply done using the UI to select …

Total answers: 2

VS Code PYTHONPATH for Windows and Linux

VS Code PYTHONPATH for Windows and Linux Question: I need to set the PYTHONPATH for a project in Visual Studio Code. I have an .env file specifying the PYTHONPATH. However, since my path consists of a number of directories, I need to use the following on Windows: PYTHONPATH=./dirA;./dirB;${PYTHONPATH} But use colon as a separator on …

Total answers: 3

Customize module search path (PYTHONPATH) via pipenv

Customize module search path (PYTHONPATH) via pipenv Question: I have a Python project consisting of a Jupyter notebook, several scripts in a bin directory and modules in a src directory, with dependencies in a Pipfile: myproject ├── myproject.ipynb ├── Pipfile ├── Pipfile.lock ├── bin │   ├── bar.py │   └── foo.py └── src ├── baz.py └── …

Total answers: 3

Anaconda: Permanently include external packages (like in PYTHONPATH)

Anaconda: Permanently include external packages (like in PYTHONPATH) Question: I know how to install packages in Anaconda using conda install and also how to install packages that are on PyPi which is described in the manual. But how can I permanently include packages/folders into the PYTHONPATH of an Anaconda environment so that code that I …

Total answers: 4

how to set different PYTHONPATH variables for python3 and python2 respectively

how to set different PYTHONPATH variables for python3 and python2 respectively Question: I want to add a specific library path only to python2. After adding export PYTHONPATH=”/path/to/lib/” to my .bashrc, however, executing python3 gets the error: Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x! I think it …

Total answers: 4

Effect of using sys.path.insert(0, path) and sys.path(append) when loading modules

Effect of using sys.path.insert(0, path) and sys.path(append) when loading modules Question: I was recently having a problem with a python ImportError, where the module was found when running on my local computer but not found on the CI server. I solved this problem by swapping sys.path.append(path) in my script with sys.path.insert(0, path) where path is …

Total answers: 2

ERROR: virtualenvwrapper could not find virtualenv in your path

ERROR: virtualenvwrapper could not find virtualenv in your path Question: I’m trying to create a virtualenv with virtualenvwrapper, but when I use mkvirtualenv I get the following : ERROR: virtualenvwrapper could not find virtualenv in your path I assumed it was a PYTHONPATH problem. But if I do a pip show virtualenv I get the …

Total answers: 13