pip: module installed as editable not found

Viewed 1535

I'm trying to install the source checkout of my own package as an editable package using pip, but it doesn't get picked up as installed. Yes, there are a whole lot of related questions, but they're mostly about non-standard directory structures. This here seems like it should "just work" and partially even does.

# starting from an empty venv:
(env) PS C:\test> pip install -e C:\path\to\my\PySymCircuit
Obtaining file:///C:/path/to/my/PySymCircuit
  Preparing metadata (setup.py) ... done
Collecting sympy
  Using cached sympy-1.9-py3-none-any.whl (6.2 MB)
Collecting mpmath>=0.19
  Using cached mpmath-1.2.1-py3-none-any.whl (532 kB)
Installing collected packages: mpmath, sympy, SymCircuit

Looks good, but:

(env) PS C:\test> python -c 'import symcircuit'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'symcircuit'
(env) PS C:\test> pip show SymCircuit
WARNING: Package(s) not found: SymCircuit

The link file that is created is correct (as well as the egg-info in the source directory), and when I try to uninstall the package, suddenly it is recognized. Just not when it matters...

(env) PS C:\test> cat .\env\Lib\site-packages\SymCircuit.egg-link
C:\path\to\my\PySymCircuit
.
(env) PS C:\test> pip uninstall SymCircuit
Found existing installation: SymCircuit 0.1.0
Uninstalling SymCircuit-0.1.0:
  Would remove:
    c:\test\env\lib\site-packages\symcircuit.egg-link
Proceed (Y/n)? Y
  WARNING: Cannot remove entries from nonexistent file c:\test\env\lib\site-packages\easy-install.pth
  Successfully uninstalled SymCircuit-0.1.0

Plain setup.py develop produces the same link, also not usable.

What am I missing?

A non-editable install from the same source tree works as intended, so I believe it has something to do with the linking mechanism?


Update: so apparently the link is just for pip, the important part is that setuptools should add the path to easy-install.pth. It doesn't, hence the error message when uninstalling. Now the question is, why...


Update as requested:

Local directory structure: git clone https://github.com/martok/py-symcircuit.git

py-symcircuit
│   LICENSE
│   README.md
│   setup.py
├───.git
├    ...
├───symcircuit
│       __init__.py
│       bode.py
│       spice.py
│       system.py
└───SymCircuit.egg-info
        dependency_links.txt
        PKG-INFO
        requires.txt
        SOURCES.txt
        top_level.txt

Setup.py:

#!/usr/bin/env python

from setuptools import setup, find_packages

setup(
    name="SymCircuit",
    version="0.1.0",
    author="Martok",
    author_email="martok@martoks-place.de",
    description="Symbolic electronic circuit analysis",
    long_description=open("README.md","rt").read(),
    long_description_content_type="text/markdown",
    url="https://github.com/martok/py-symcircuit",
    project_urls={
        "Bug Tracker": "https://github.com/martok/py-symcircuit/issues",
    },
    license="MIT",
    classifiers=[...],
    packages=find_packages(),
    python_requires='>=3.6',
    install_requires=[
        "sympy",
    ],
    extras_require={
        "EE": [
            "networkx",
            "numpy",
            "mplotkit"
        ],
    },
)
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)] on win32
Package          Version  
---------------- ---------
pip              21.3.1
setuptools       59.4.0
0 Answers
Related