pythonpath

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

Eclipse/PyDev: Sync System PYTHONPATH runs continuously

Eclipse/PyDev: Sync System PYTHONPATH runs continuously Question: When Eclipse/PyDev is open I see an operation running in the background, over and over (as if stuck in an infinite loop), in the lower right status area telling me “Sync System PYTHONPATH (100%)”. I have a single Python interpreter configured, everything runs fine, but I wonder if …

Total answers: 1