All Questions
Tagged with python-packaging python-module
94
questions
1
vote
1
answer
166
views
What is the difference between installing a module with pip/setup.py vs adding it to PYTHONPATH?
I have a custom Python module I want to use in another project. This module gets deployed to production as well. I have two options:
Add a setup.py and install the module locally with pip.
Add the ...
0
votes
0
answers
24
views
Absolute import to access a python module in a directory above
I have the above file structure. Within src/jobs there is a file common.py which has code that will be reused across all the different jobs. Each job will be in a separate sub-directory. I want to ...
0
votes
0
answers
205
views
How properly set up internal imports in Python package?
I am developing a Python 3 package (say "Project1"), which I want to use in another Python project (say "Project2"). The structure of the Project1 is, briefly, like this:
/...
0
votes
2
answers
254
views
Can't import my own module in my test file
I have the following project structure :
.
├── README.md
├── document_processing
│ ├── Config.py
│ ├── DocumentParser.py
│ ├── FileChecker.py
│ └── __init__.py
├── indexing.py
└── tests
├──...
0
votes
0
answers
30
views
Why some method's doc string shows up in Spyder but not others?
I have module pyspark.sql.functions loaded:
>>> sys.modules['pyspark.sql.functions']
<module 'pyspark.sql.functions' from 'C:\\Users\\User.Name\\anaconda3\\envs\\py39\\lib\\site-packages\\...
1
vote
0
answers
176
views
What is the difference between import a module from a folder and import a module from a package?
I need to better understand the difference between a normal directory and a Python package. I know this sentence present in the Python documentation about modules and in particular in the paragraph ...
0
votes
0
answers
54
views
Fully qualified imports from `foo/setup.py`, `foo/bar/__init__.py` to get `import foo.bar`?
Given this directory structure:
/tmp/foo
|-- bar
`-- __init__.py
`-- setup.py
…and this setup.py:
from setuptools import find_packages, setup
package_name = 'foo'
module_name = 'bar'
setup(
...
0
votes
0
answers
68
views
Package with "typing" subpackage causing naming collision
I'm having an issue with a Python package that has a typing subpackage. When I try to import a module from this package, it seems that the typing subpackage in the package is being assigned to the ...
2
votes
2
answers
1k
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
2
answers
255
views
How importing packages and subpackages actually work?
I've been trying to understand how importing packages and subpackages works in Python. Based on what I understood from realpython.com, a package is simply a directory that contains python modules and ...
0
votes
0
answers
79
views
Unable to run Python app outside of PyCharm due to ModuleNotFoundError
I am working within a large Python codebase that has multiple sub-packages which contain their own Python apps. Note that these sub-packages are local source code and must be installed via pip install ...
0
votes
1
answer
2k
views
How to import a file from another folder in a package [duplicate]
My project structure looks like this
pythonProject
|
|-__init__.py
|
|- a
| |- file_a.py
| |-__init__.py
|
|- b
|- file_b.py
|-__init__.py
I've also attached the image of my project's ...
0
votes
0
answers
121
views
Python module referencing issue
I have the below directory structure:
src/
--check.py
--quantum/
----__init__.py
----ansatz.py
----hva/
------__init__.py
------single_layer_hva.py
In my check.py, I'm doing the below:
#check.py
...
0
votes
1
answer
419
views
ModuleNotFoundError when trying to import file from one folder into another file located in another directory
I working with a group on a project that is being used with Git and Github. I have a local main project folder that contains two sub-directories(i.e Utilities and Testing). However, in order to run ...
3
votes
3
answers
7k
views
How to import module using path related to working directory in a python project that managed by poetry?
I'm using poetry to manage my python project, here's the project:
my_project/
├── pyproject.toml
├── module.py
└── scripts/
└── main.py
And I want to know how to import function from module.py ...