I am trying to set up an editable install of PyDelphin so that I can expand the MRS package somewhat. (I want to create a SEMENT class, which I have another post about here).
I am having trouble with the editable install breaking the import statements.
My directory structure is something like this:
sandbox/
- pydelphin/
- project_src/
I ran pip install -e ./pydelphin from the sandbox/ directory per the installation instructions.
When running pip list I see the following for PyDelphin:
PyDelphin 1.6.0 /Users/elizabeth/Documents/sandbox/pydelphin
This suggests to me that the install worked correctly and has been installed from the directory I cloned. But now all of the imports are broken and anything that starts with from delphin or import delphin is an unresolved reference. If I do from pydelphin.delphin it works, but I don’t think this is what should be happening. I would’ve expected the editable install to resolve these paths correctly but it isn’t for some reason.
Hmm, that’s interesting. I’m not seeing that when I try a fresh install:
$ mkdir pytmp
$ cd pytmp
~/pytmp$ gh repo clone delph-in/pydelphin
Cloning into 'pydelphin'...
remote: Enumerating objects: 7250, done.
remote: Counting objects: 100% (376/376), done.
remote: Compressing objects: 100% (213/213), done.
remote: Total 7250 (delta 223), reused 266 (delta 159), pack-reused 6874
Receiving objects: 100% (7250/7250), 2.54 MiB | 2.96 MiB/s, done.
Resolving deltas: 100% (5531/5531), done.
~/pytmp$ python3 -m venv env && source env/bin/activate ~/pytmp$ python3 -m pip install -e "./pydelphin/[dev]"
[...]
~/pytmp$ python3
Python 3.10.5 (main, Aug 1 2022, 07:53:20) [GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import delphin.mrs
>>>
PyDelphin uses PEP-420 implicit namespace packages to support plugins, so one thing that could go wrong is if you have somewhere on your Python path (perhaps under project_src/) a delphin/ subdirectory containing an __init__.py file.
Another thing is to make sure you are installing PyDelphin to the right environment, whether you’re using a virtual environment (as above) or your system one.
Does this info help?