Questions tagged [pythonpath]

PYTHONPATH is an environment variable that can be used to augment the default search path for module imports in Python.

PYTHONPATH is an environment variable that can be used to augment the default search path for module files in Python. Values will be added to sys.path.

758 questions
6
votes
5 answers

How can I correct a corrupted $PYTHONPATH?

When trying to launch Mercurial(hg) after a restart in my Ubuntu 9.10 Linux Box I got following message: abort: couldn't find mercurial libraries in [/usr/bin /usr/local/lib/python2.6/dist-packages/vipy-0.4-py2.6.egg…
Kenny Meyer
  • 7,849
  • 6
  • 45
  • 66
6
votes
3 answers

PYTHONPATH vs symbolic link

Yesterday, I edited the bin/activate script of my virtualenv so that it sets the PYTHONPATH environment variable to include a development version of some external package. I had to do this because the setup.py of the package uses distutils and does…
Kal
  • 1,707
  • 15
  • 29
6
votes
2 answers

Python .pth Files Aren't Working

Directories listed in my .pth configuration file aren't appearing in sys.path. The contents of configuration file, named some_code_dirs.pth: /home/project Paths to the…
chernevik
  • 3,922
  • 9
  • 41
  • 55
5
votes
3 answers

Python 2.x multiple version issues regarding PYTHONPATH

There's Python 2.6 installed in the system. Now I want to use modules introduced in Python 2.7. Because I have no root privilege, I have built & installed 2.7 under my home directory ($HOME/local/) I added the following to my $HOME/.bashrc: export…
niboshi
  • 1,448
  • 3
  • 12
  • 20
5
votes
2 answers

Python relative imports within a package not on the path

How can I import a file that is in a parent directory within a python package (that is not on the path) into a file in a child dir? I'm not totally clear on the vocabulary of python packaging so by way of example: dir1/ __init__.py …
Finn
  • 1,823
  • 2
  • 15
  • 31
5
votes
3 answers

Automatically call common initialization code without creating __init__.py file

I have two directories in my project: project/ src/ scripts/ "src" contains my polished code, and "scripts" contains one-off Python scripts. I would like all the scripts to have "../src" added to their sys.path, so that they can access the…
SuperElectric
  • 17,548
  • 10
  • 52
  • 69
5
votes
1 answer

python.pythonPath saying "unknown configuration setting" on VS code on Macbook M1

I have just started to get into programming and needed some help. My issue started when I would open up my VScode on my Mac and my python interpreter version would not show up in the status bar. I've asked a similar question: Python Interpreter…
5
votes
2 answers

Application-specific PYTHONPATH

I have an application with a heirarchy of packages. There are a fair number of modules that reference other modules higher up in the package heirarchy. As exemplified below, I can use relative imports to solve this problem. However, running the…
MikeWyatt
  • 7,842
  • 10
  • 50
  • 71
5
votes
4 answers

Azure DevOps Pipelines - Python - ModuleNotFoundError despite sys.path.append() or setting PYTHONPATH

I'm trying to run some tests for my python application but I'm not able to set the path correctly so that my test.py can find it. My Application is structured like this: repo/src/main/python/main_module repo/tests/test.py And my test.py is looking…
5
votes
3 answers

Does a large and expansive PYTHONPATH affect performance?

Let's say you have a project that has several levels of folders going on and in various places, to make import calls cleaner, people have amended the PYTHONPATH for the whole project. This means that instead of saying: from folder1.folder2.folder3…
apanzerj
  • 467
  • 3
  • 9
5
votes
2 answers

PYTHONPATH ignored with python3 on windows

I use windows 7 without admin rights and i would like to use python3. Even if i set PYTHONPATH, environment variable is ignored. However PYTHONPATH is valid when printed. >>> print(sys.path) ['c:\\Python365\\python36.zip', 'c:\\Python365'] >>>…
Gilles
  • 49
  • 7
5
votes
2 answers

Django (w PyCharm) & PYTHON PATH issue

I have purchased PyCharm and am trying to get things to work however I am encountering this issue.. Once I start a project everything works great... Now if I want a standalone app.. let's say at /users/me/djangoApps I understand I have to add this…
surfsim
  • 51
  • 1
  • 2
5
votes
0 answers

Python module pkg_resources.require()

I have a problem loading the correct version of a python module. I have no admin rights, so the stuff installed under $PYTHONHOME and $PYTHONPATH are read only. Unfortunately the module(s) that reside there are the wrong version. I have the correct…
mschmidt
  • 81
  • 1
  • 2
5
votes
2 answers

Setting PYTHONPATH on Windows under Anaconda without elevated privileges

I have a Windows 7 machine with a 32-bit install of anaconda, installed for the local user. The install works as expected: it allows me to run python and pip from the command line, switch environments, etc. I also have a library of code that I wrote…
Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
5
votes
1 answer

Pyspark append executor environment variable

Is it possible to append a value to the PYTHONPATH of a worker in spark? I know it is possible to go to each worker node, configure spark-env.sh file and do it, but I want a more flexible approach I am trying to use setExecutorEnv method, but with…
guilhermecgs
  • 2,913
  • 11
  • 39
  • 69