Issue
Description of the problem
When installing my coolcustom
package via py -3.11 -m pip install -e .
the package cannot be imported from elsewhere.
Minimal example of reproducing my problem
My project structure looks like this
Documents/
├─ testing_package/
│ ├─ coolcustom/
│ │ ├─ __init__.py
│ │ ├─ setup.py
│ │ ├─ main.py
setup.py
looks like this
from setuptools import setup, find_packages
setup(
name='coolcustom',
version='0.1',
packages=find_packages(),
)
After I install the package using
C:\...\Documents\testing_package\coolcustom>py -3.11 -m pip install -e .
Obtaining file:///C:/Users/viktor/Documents/testing_package/coolcustom
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: coolcustom
Building editable for coolcustom (pyproject.toml) ... done
Created wheel for coolcustom: filename=coolcustom-0.1-0.editable-py3-none-any.whl size=2425 sha256=1fcbdb8196af21eee8da2dd58bec327bb0de614e89d1e36af51bf3ef4a77d7ad
Stored in directory: C:...\AppData\Local\Temp\pip-ephem-wheel-cache-oucj9xsh\wheels\7a\b2\30\0f92e762acafbb9145d2d426806835dd76cbee08ff561f565b
Successfully built coolcustom
Installing collected packages: coolcustom
Successfully installed coolcustom-0.1
No errors seem to popup. I even verify the installation with
py -3.11 -m pip list
Package Version Editable project location
------------------------ ------------ ----------------------------------------------------
..other packages here
coolcustom 0.1 C:...\Documents\testing_package\coolcustom
However when I cd
out of the project and try to import the coolcustom
package it fails
cd ../..
C:...\Documents>py -3.11 -c "import coolcustom"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'coolcustom'
What I have tried so far
- Installing the package in non-editable (normal) mode after uninstalling the editable version and it still did not work
- I could not find .egg-link file neither in
\AppData\Roaming\Python\Python311\site-packages
nor in\AppData\Local\Programs\Python\Python311\Lib\site-packages
- However I have found
coolcustom-0.1.dist-info
folder,__editable___coolcustom_0_1_finder.py
, and__editable__.coolcustom-0.1.pth
inside the\AppData\Local\Programs\Python\Python311\Lib\site-packages
meaning that the setup did do something.
I am very new to using setuptools, so maybe there is an obvious error I am doing?
Solution
I forgot that setup.py is supposed to be in the outside folder... sorry
Answered By - Viktor Veselý
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.