774 questions
1
vote
0
answers
83
views
Pycharm fails to find package in the defined PYTHONPATH
I have a Python monorepo. One of the services in this monorepo is "poller-service". Its general structure is:
services/
└── poller-service/
├── .venv/
| └─ ...
...
0
votes
0
answers
104
views
How to make PyCharm recognize dynamic imports for local scripts?
I'm facing a peculiar issue with PyCharm and Python imports. I have a well-organized directory with all my "stable" code, and a separate area for local scripts that are more experimental and ...
0
votes
0
answers
62
views
why won't Pycharm accept my file location for Pythonpath?
I am configuring my robot framework on a project level and am trying to enter my project file location as the pythonpath. Next to the field is this text:
Entries to be added to the PYTHONPATH
(used ...
0
votes
1
answer
162
views
Minimal way to set PYTHONPATH for developing python in VS Code and Jupyter notebook server
Related questions that do not apply:
Set PYTHONPATH for local Jupyter Notebook in VS Code - does not apply to running Jupyter server.
How to set pythonpath at startup when running jupyter notebook ...
2
votes
2
answers
202
views
Persistent ModuleNotFoundError: No module named 'src' in Python Project
I'm working on a Python project with the following structure:
/
├── src/
│ ├── __init__.py
│ ├── afrr/
│ │ ├── __init__.py
│ │ ├── dumper.py
│ │ └── cleaner.py
│ ├── config.py
│ ├──...
0
votes
0
answers
43
views
Python import on sub-package results in "no module named..." error
Although there are a number of import related questions, I haven't found one that directly addresses my question.
I have installed some packages in the default Site Packages folder and it has a ...
0
votes
0
answers
173
views
How should I manage multiple versions of a library in a Python project
I am working on a Python project, which has to support multiple versions of the same package.
For each new version, some of our wrapper classes change, and others remain unchanged from the previous ...
0
votes
0
answers
50
views
Unable to use Absolute Import to get Objects from Package __init__.py (despite PYTHONPATH Setting)
(Neither this question nor this question are duplicates - they are all resolved by setting the PYTHONPATH correctly.)
I have the basic file structure of a Python package, located in ~/github/mypackage:...
0
votes
0
answers
157
views
Visual Studio Code python .env file to work for both Windows and Linux
I want to use exactly the same vscode workspace folder on both Windows and Linux.
As you may know, contrary to Pycharm, the root folder is unfortunately not included in the python path. So for my ...
0
votes
0
answers
73
views
How to re-define PYTHONPATH --completely-- in Visual Studio Code
I need to re-define the PYTHONPATH within Visual Studio Code (VSC) without it inheriting any values from the default PYTHONPATH set in my shell (zsh).
System Information:
macOS: Sonoma 14.6.1,
Visual ...
0
votes
1
answer
210
views
Setting PYTHONPATH in Eclipse/PyDev
Added later: I stupidly capitalized OS rather than using os, so the import and print now works properly. However, the question remains: how can I add a source directory that is outside the project ...
0
votes
0
answers
55
views
Python: Own package not recognized
I have an issue where I dont get the solution.
I also look here in stackoverflow.com, tried different solutions but nothing helps.
My project struct looks like this:
-MyFolder
----MySubFolder
------...
1
vote
1
answer
109
views
How to include the project root folder into PYTHONPATH when running python script in sub folder
Here's my project structure
- folder_1
- folder_2
- file1.py
- file2.py
- folder_3
- file3.py
Now I use this command to run file1.py
python folder_1/folder_2/file1....
0
votes
1
answer
273
views
Pytest ModuleNotFoundError: No module named 'app' despite working in Docker environment
I'm encountering an issue where pytest fails to run tests in my local development environment due to a ModuleNotFoundError, specifically stating that there is "No module named 'app'". ...
0
votes
1
answer
168
views
Run & Debug depends on Windows PYTHONPATH/HOME environment variables
I'm working on a project where I debug with GDB and OpenOCD. Sometimes we use VS Code for this purpose and I encountered an issue that the Run & Debug session won't launch when PYTHONHOME/...
0
votes
1
answer
362
views
SignalIntegrity cannot import name 'math' from 'numpy'
I can not launch the SignalIntegrityApp GUI application
I carefully followed the instructions in the website:https://github.com/Nubis-Communications/SignalIntegrity/wiki/Installation
However, when I ...
0
votes
1
answer
32
views
python: NON-pipadmin user gets ModuleNotFoundError after pipadmin installs ipython
Not a question, sharing something that worked for me:
Two linux users, both in the same "programmers" linux group.
1st user is pipadmin, and does "pip install ipython" to a local ...
2
votes
1
answer
981
views
How to change the root directory of a Python project?
I have a simple Django project (namely the one from this tutorial).
The main part of the tree looks like this:
.
├── env
├── proj
│ ├── proj
│ │ ├── __init__.py
│ │ ├── settings.py
│ │ ├─...
0
votes
1
answer
50
views
invoking a python script from the command line leads to “[Errno2]" - PYTHONPATH is set
Ignorant new Linux/Ubuntu/StackOverflow user here.
I have my scripts for users to run in a path like /home/user/Projects/scripts/. If that is the pwd, I can invoke a script like this:
~/Projects/...
0
votes
1
answer
826
views
sys.path not always/reliably set by sitecustomize -- how can it be reliably overridden?
I have an application using embedded Python, which includes python.exe. I have added a sitecustomize.py to set sys.path, something like:
import sys
sys.path = ['.','.\\python310.zip','.\\Lib','.\\Lib\\...
0
votes
0
answers
94
views
Running different python environments within python script in linux
For my Uni thesis project, I need firstly to setup automatically multiple github repositories within python script. Problems I am facing is that:
each repository has its own requirements and some of ...
0
votes
1
answer
110
views
Why PYTHONPATH need to be exported? [duplicate]
I am getting some module not found excepiton when setting PYTHONPATH and then executing some py script :
$ PYTHONPATH=somepath/a/b
$ python myscript.py
Exception has occurred: ModuleNotFoundError ...
1
vote
0
answers
65
views
how do I guide pabot to find my custom libraries or APIs?
I am using Pabot of Robot Framework. I have created a whole application that in background runs the Robot Framework.
This exe understands the path which I mentioned during pyinstaller. So it opens up ...
1
vote
1
answer
413
views
How do I get an application using python to ignore PYTHONHOME and/or PYTHONPATH?
I am trying to debug a command line C module on Windows, which is a part of a much larger open source GIS software (GRASS GIS). GRASS on the command line (sort of) adopts a "UNIX Tools" ...
1
vote
0
answers
335
views
PyCharm "Interpreter Paths" -- What are they and where are they stored?
I have a PyCharm project, named pycharm_projects. In it, I create a virtualenv Python interpreter, example_virtualenv. Then I click Interpreters -> Show all -> example_virtualenv -> Show ...
0
votes
1
answer
110
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=&...
0
votes
1
answer
322
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 ...
1
vote
0
answers
129
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 ...
0
votes
1
answer
1k
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 ...
1
vote
2
answers
892
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 ...
0
votes
0
answers
523
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): ...
0
votes
0
answers
139
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__
- ...
0
votes
0
answers
46
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 ...
0
votes
1
answer
63
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/
...
0
votes
0
answers
1k
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 ...
0
votes
3
answers
7k
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 ...
1
vote
1
answer
272
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')...
0
votes
0
answers
162
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 ...
0
votes
1
answer
317
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 ...
0
votes
0
answers
86
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
├...
0
votes
1
answer
53
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/...
0
votes
3
answers
17k
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 ...
0
votes
2
answers
294
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....
8
votes
1
answer
38k
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.
...
0
votes
0
answers
138
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/...
0
votes
1
answer
328
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 ...
2
votes
2
answers
2k
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)
━...
0
votes
0
answers
72
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 ....
1
vote
1
answer
3k
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 ...
1
vote
1
answer
2k
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 ...