Questions tagged [pythonpath]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
32 views

FileNotFound error when importing packages

I am creating a voice assistant using python 3.11.6, and inside of my project i have a "Synthesizer "package, which has two files: model.pt and main.py. In that main.py (self.local_file=&...
Илья Мирошниченко's user avatar
0 votes
1 answer
27 views

Visual Studio Code working with Python with PYTHONPATH and separate source and tests folders

Given a project structure: * project * src * my_package * __init__.py * code_file.py * tests * __init__.py * my_package * __init__.py * code_file_test.py How ...
Danny Varod's user avatar
  • 17.5k
0 votes
0 answers
33 views

Keep Python code safe from execution by Pydoc

This question is related to the question Stop pydoc from running my Python program, except that here I'm not actually trying to document my own code - I'm just trying to use pydoc to look up unrelated ...
Metamorphic's user avatar
0 votes
0 answers
22 views

Setting `PYTHONPATH` for an Open Source Shiny Server Deployment

I was trying to set up an open source shiny-python server following the instructions here. However, the shiny server does not seem to read the system's PYTHONPATH. Is there a way I can set the ...
Devil's user avatar
  • 915
0 votes
1 answer
55 views

Use Windows cmd to set PYTHONPATH for embedded Python interpreter

I am using Windows batch as the entrance for users to run a Python script for some simple automation requests. I have referred to the answer. Assuming I have used another batch to copy the embedded ...
hirobank's user avatar
0 votes
1 answer
112 views

VSCode Python unittest discovery fails: 'utils' is not a package -> sys.path ordering?

since a few days, Visual Studio Code Python unittest discovery no longer works for me in several projects that contain a package called utils: 2023-10-18 09:37:36.901 [info] Discovering unittest tests ...
Philipp Burch's user avatar
0 votes
0 answers
65 views

Unable to call Python method from Robot Framework: No keyword with the name 'method_name' was found

I'm facing an issue when trying to call a Python method from a Robot Framework test case. I have the following Python method defined in a file named campaign.py: def print_something_test(self, text): ...
Husny Jiffry's user avatar
0 votes
0 answers
43 views

Starting Django Project with gunicorn: No module named: "myproject"

I am having trouble starting my django project with gunicorn In order to figure out what's wrong, I created an empty django project to work with: myproject - myproject - __init.py__ - ...
lzlll3811's user avatar
0 votes
0 answers
28 views

Setting up a Python environment to point to a modules directory on a Mac

I'm trying to set up a local development environment for Python. We use BitBucket for source control of Python modules we've developed for our company. On my machine I have this folder/directory set ...
PruitIgoe's user avatar
  • 6,206
0 votes
1 answer
36 views

Fun Python import issue

I am getting a strange module not found error and I can't seem to grasp why it is happening. I have a directory structure of: projects/services/skittles/app/ database/ ...
Trance2000's user avatar
0 votes
0 answers
224 views

Python Imports - How to avoid sys.path.append

I have a bug with imports in python I’m having a hard time to solve or even understand why it happens.I didn’t write the codebase so please forgive the fact that absolutely zero python naming ...
codeartha's user avatar
0 votes
1 answer
477 views

Unable to install Anaconda on my Windows 11 64-bit PC

I am getting the following error while installing anaconda on my Windows 11 machine. I have already tried the below steps, but it still doesnt seem to work: Uninstall any previous Anaconda or Python ...
Anand Subramanian's user avatar
1 vote
1 answer
78 views

Python: xlwings and sub directories

I have 2 functions. I want to check if a file exist in a sub directory. def XlCall(): wb = xw.Book.caller() from pathlib import Path entries = Path('./History/data.csv') wb.sheets('TA')...
Tom's user avatar
  • 11
0 votes
0 answers
55 views

Ubuntu / Python: Module not found error, but script starts via terminal

I have written a python script using Python 3.10 and like to start the script via my PoP OS! library link that I created. My .desktop file is in the correct directory in usr/share/applications, was ...
Axiom42's user avatar
  • 35
0 votes
0 answers
32 views

Port a Python application from Visual Studio to Ubuntu 22.0 running an Eclipse IDE with its PyDev extension

The Visual Studio app has the following tree structure: MCTS |------dlgo | |-----encoders folder | |-----some .py files | |------generate_mcts_games.py import numpy as np from ...
Pierre Michallet's user avatar
0 votes
0 answers
18 views

Dockerfile installing all python imports but when running the container the modules are not found

I am working for a company and I don't think I can exactly show the code but I have a basic docker file with all the python packages are importes in this format RUN pip install \ netifaces \ ...
Rehan Mc's user avatar
0 votes
1 answer
65 views

How can numpy uninstall error in python 3.8?

I want to uninstall numpy in Python 3.8. I tried to that command "pip3 uninstall numpy",but this didn't work. I modified the PYTHONPATH in my ~/.bashrc file and exported PYTHONPATH, but ...
chimchim's user avatar
0 votes
0 answers
48 views

How to structure a Python project to have Unit Tests

I am facing difficulties to get the module's references in the Unit Test files. This is my level 1: $ backend-app ├── Dockerfile ├── __init__.py ├── app ├── credentials-dev.json ├── requirements.txt ├...
Augusto's user avatar
  • 3,905
0 votes
1 answer
36 views

How to get pythonpath to work for the python module in openmodelica Buildings running ubuntu 20

I am having problems running my model in openmodelica on ubuntu 20. I tried exporting the path following the documentation and installed libpython3.8-dev. https://build.openmodelica.org/Documentation/...
Luis Enriquez-Contreras's user avatar
-1 votes
3 answers
2k views

PYTHONPATH from launch.json not visible in Python script (VS Code)

I would like to import methods from a directory one level above my current working directory. One way to do this is to manually append the directory to sys.path. I found a better solution for VSCode ...
vpk's user avatar
  • 1,260
0 votes
0 answers
63 views

Modify sys.path or $PYTHONPATH so that my app works with a different version of Python and its site-packages

I have a Flask App deployed on a server, which is trying to use the Python3.10 version and its installed site-packages. I removed this version for certain reasons and I want to change the path to the ...
Carlos Ordiñana's user avatar
0 votes
2 answers
68 views

cannot setup PYTHONPATH environmental variable in vscode

I tried to set up PYTHONPATH environmental variable in vscode in Mac, and it does not work. VScode version: Version: 1.78.1 (Universal), Mac os: 13.3.1 (a) I followed the instruction: https://code....
Arthur's user avatar
  • 181
1 vote
1 answer
3k views

Is `PYTHONPATH` really an environment variable?

The docs for sys.path state the following: A list of strings that specifies the search path for modules. Initialized from the environment variable PYTHONPATH, plus an installation-dependent default. ...
user32882's user avatar
  • 5,236
0 votes
0 answers
77 views

Python pytest Exclude Test Directory in PYTHONPATH

I have a weird scenario with pytest where we need to exclude the test directory from PYTHONPATH during the test. Context The pytest command for reference python -m pytest main_project_a/folder_a/...
YTKme's user avatar
  • 137
0 votes
1 answer
79 views

python cannot import class, path variable shown defaults to anaconda?

my file directory is simple: /Users/dd/python/folder/ main.py store.py __init__.py # store.py class Store: def __init__(self,location): self.location = location # main.py from ...
user40551's user avatar
  • 365
0 votes
0 answers
54 views

How to add geant4 module in python IDE?

Recently I've install Geant4(https://github.com/koichi-murakami/g4python) and would like to import geant4 in IDE like VS or PyCharm. But the ide doesn't see the package. While in terminal i can import ...
teoretik_eugene's user avatar
0 votes
0 answers
44 views

Airflow cannot import local module - false flag

I have a repo that has the below structure. etl --dags --src ----foo Everything currently works in terms of running the dags. However, when I go to the UI, I see "Broken DAG: [path] No module ...
jimhens's user avatar
2 votes
2 answers
541 views

Pip installs packages in the wrong directory

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) ━...
LWB's user avatar
  • 456
0 votes
0 answers
59 views

VSC recognizes module name when I type it, but throws exception at runtime

I'm using VSC Remote Server to access code on a linux server. There I'm trying to import .py files from another directory. I've added the directory to import from to the server's PYTHONPATH via ....
Self's user avatar
  • 1
1 vote
1 answer
1k views

ModuleNotFoundError: No module named 'openvino'

I'd like to run some official OpenVINO samples, but I always get the following error: from openvino.inference_engine import IECore ModuleNotFoundError: No module named 'openvino' I created a simple ...
IanHacker's user avatar
  • 541
0 votes
0 answers
42 views

How DASK_jobqueue SLURMCluster can access local python module in parent directory

I'm using dask_jobqueue to establish a SLURMCluster. I'm trying to pass python files in the parent directory to the workers. I tried different ways including sys.path.append, setting PYTHONPATH in my ....
shambakey1's user avatar
1 vote
1 answer
815 views

Why does pip install not work for catboost? Problem with python distribution

I have to install catboost but can not make it by pip install catboost. Pip sad 'No matching distribution found for catboost' but that is not as i think. I read this question Why does pip install not ...
Ларионов Фёдор's user avatar
0 votes
1 answer
152 views

Anaconda Jupyter Notebook Opencv not working

Ok so to preface this, I am very new to jupyter notebook and anaconda. Anyways I need to download opencv to use in my notebook but every time I download I keep getting a NameError saying that ‘cv2’ is ...
prgrmr_dal's user avatar
0 votes
0 answers
162 views

Error in running python file using ASE library

I am trying to run a python script using ASE library, I have installed ase (https://wiki.fysik.dtu.dk/ase/install.html)and run my python script using this library on my terminal. I have made a virtual ...
Formal_this's user avatar
0 votes
1 answer
87 views

Unable to add folders to PYTHONPATH when creating conda environment

I have a script that is making a conda virtual environment where functions need to be imported from folders outside of the repo. I have tried two approaches to add the folders to the path: Conda ...
illan's user avatar
  • 163
0 votes
1 answer
297 views

Why does my pip access two site-packages?

I have a bit of confusion with pip and multiple python installations. When running python -m pip install pb_tool I get console output: Requirement already satisfied: pb_tool in c:\osgeo4w\apps\...
Honeybear's user avatar
  • 3,008
3 votes
1 answer
1k views

Pylint in Neovim using Mason and null-ls cannot load packages

I was hoping you would be able to help me get pylint fully functional in nvim. Env: Mac OS Venture 13.1 nvim v0.8.1 pylint 2.15.9 python 3.11.1 (accessed through 'python3') pip 22.3.1 (accessed ...
awkh's user avatar
  • 31
0 votes
1 answer
595 views

VS Code - How to add folders to the search path in a Python project?

I've recently switched from Spyder to VS Code to code my Python projects. Spyder is great for me because it uses IPython, i.e., it is based on a REPL (interactive environment), but it still lacks some ...
Humberto Fioravante Ferro's user avatar
0 votes
0 answers
111 views

Why isn't Visual Studio Code python debugger finding my modules?

I am trying to import a module of a parallel folder in my python project. The structure is as follows: ~/src/ | |---calculator/ | |---calculator.py |---__init__.py |---...
mskraod's user avatar
0 votes
1 answer
52 views

Python is not importing functions from module when using PythonPath

I have a simple project trying to illustrate how Python Path works. Illustrated below is my current project structure.main.py looks like this, import pathlib import sys cwd = pathlib.Path(__file__)....
Joe's user avatar
  • 173
1 vote
1 answer
564 views

Python subprocess can't find Pythonpath module

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 ...
mayool's user avatar
  • 148
0 votes
1 answer
161 views

PYTHONPATH works in interactive mode but fails in script

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 ...
griffin97's user avatar
2 votes
1 answer
7k views

How can I ensure that my Python version is updated after installing version 3.11 using Mac?

I've just installed Python version 3.11 (I also moved versions 3.8 and 3.9 to the trash from my Applications folder). I can see it in the following: $ myname@name-MBP miniconda3 % ls /usr/local/bin/py*...
quanty's user avatar
  • 882
0 votes
1 answer
55 views

PYTHONPATH - bug or am I going crazy?

I wanted to reach for a python module outside of my current working directory of my script - *test.py*, theproject ├── one_folder │   ├── main.py │   └── src │   ├── test.py └── ...
michuhu's user avatar
  • 93
0 votes
1 answer
526 views

Suddenly ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable?

Suddenly my Django project showed me the following ImportError: "ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you ...
kokserek's user avatar
  • 540
0 votes
2 answers
213 views

does python utilize PATH environment?

My python script is being called by kea-dhcp, which has capability of executing external scripts (https://kea.readthedocs.io/en/latest/arm/hooks.html#run-script-run-script-support-for-external-hook-...
Mark's user avatar
  • 6,092
1 vote
0 answers
354 views

The PYTHONPATH environment variable does not populate sys.path

In: WINDOWS PowerShell, Python 3.10.7 I added environment variables PS C:\Users\luoyf\Desktop> $env:PYTHONPATH PS C:\Users\luoyf\Desktop> $env:PYTHONPATH="D:\Workspace" PS C:\Users\...
time day's user avatar
0 votes
0 answers
821 views

Python interpreter path not working for resource file with PyCharm and Robot Framework Language Server-plugin

I am trying to get following Robot Framework project structure to work with PyCharm and Robot Framework Language Server-plugin installed on Ubuntu 20.04. suite.robot *** Settings *** Resource ...
jm90's user avatar
  • 137
0 votes
1 answer
723 views

ModuleNotFoundError but path is in sys.path

I have the following project structure: my-project src __init__.py main.py utils __init__.py configs modules __init__.py other_module.py My main.py script is ...
VErYSEYmPhY's user avatar
1 vote
0 answers
411 views

Python project dependency on external Git repo

I have a project that depends on an external Github repo. What's the correct way to include this dependency in my project? Note: the dependency is not a pip package, but a Python project hosted in ...
Shahar's user avatar
  • 71

1
2 3 4 5
16