Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module not found after pip install #113

Closed
orbeckst opened this issue May 23, 2024 · 13 comments · Fixed by #115
Closed

module not found after pip install #113

orbeckst opened this issue May 23, 2024 · 13 comments · Fixed by #115
Labels
bug Something isn't working

Comments

@orbeckst
Copy link
Member

I followed the MDAKit tutorial word for word and then install with either pip install -e . or pip install ..

When trying to import the rmsfkit package, I get the following import error:

(rmsfkit) deathstar:tmp oliver$ python
Python 3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:38) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rmsfkit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'rmsfkit'
>>>

The only relevant dir I can find in ~/anaconda3/envs/rmsfkit/lib/python3.12/site-packages/ is rmsfkit-0.0.0+3.g28a9cd7.dist-info.

Building a package with

$ mamba install build
$ python -m build

and installing with

$ pip uninstall rmsfkit
$ pip install dist/rmsfkit-0.0.0+3.g28a9cd7-py3-none-any.whl

leads to the same failure to import the package.

It appears that either I do something stupid somewhere or that somehow the package is broken.

I am on macOS 13.x on an Intel CPU.

$ mamba --version
mamba 1.4.9
conda 23.7.4

In the environment

(base) deathstar:rmsfkit oliver$ mamba activate rmsfkit
(rmsfkit) deathstar:rmsfkit oliver$ python -V
Python 3.12.0
(rmsfkit) deathstar:rmsfkit oliver$ pip --version
pip 24.0 from ~/anaconda3/envs/rmsfkit/lib/python3.12/site-packages/pip (python 3.12)
(rmsfkit) deathstar:rmsfkit oliver$ which python
~/anaconda3/envs/rmsfkit/bin/python

See also MDAnalysis/mdgeomkit#1 .

@IAlibay
Copy link
Member

IAlibay commented May 24, 2024

Just to link back in the "solution" from the other package - we needed to explicitly define:

[tool.setuptools.packages.find]
include = ["directoryname"]

This seems like an easy enough fix, but I just don't understand why the current cookiecutter CI isn't picking it up :/

@orbeckst
Copy link
Member Author

Is this an issue with upstream cookiecutter itself or our (or MolSSI's) template?

@IAlibay
Copy link
Member

IAlibay commented May 24, 2024

Ours I believe, we made the switch to pyproject.toml after we first forked from the molssi cookiecutter

@orbeckst
Copy link
Member Author

When @ianmkenney made the tutorial, we must have still had a setup.py because both PR MDAnalysis/MDAKits#140 and MDAnalysis/MDAKits#144 removed these references after following the tutorial recently and not seeing setup.py.

@orbeckst
Copy link
Member Author

@ljwoods2 I think you recently build a mda-cookiecutter based project. Did you run into this issue that it didn't install for you?

@orbeckst
Copy link
Member Author

@lilyminium or @IAlibay could you please take on fixing the cookiecutter? This is reasonably high priority because we want to use the mda cookiecutter for the MDA/MolSSI workshop and the MolSSI folks need it to work soon so that they can prepare their part.

@IAlibay
Copy link
Member

IAlibay commented May 24, 2024

@orbeckst so sorry about delays, I can put this at the top of the priority list - is ~ end of the month reasonable? Depending on how much capacity others have this might be as realistic a timeline as I can give.

@orbeckst
Copy link
Member Author

@lilyminium can you do it sooner than @IAlibay ?

@orbeckst
Copy link
Member Author

@lilyminium and @IAlibay I apologize for my pushy comments above which, on second reading, very much sound as if I am not respecting your time.

I am happy to discuss more offline and explain my sense of urgency while also understanding the constraints that you are operating under.

@ljwoods2
Copy link
Contributor

@orbeckst this is how I did it for the zarrtraj mdakit

[tool.setuptools]
packages = ["zarrtraj"]
py-modules = ["__init__"]

As per: https://stackoverflow.com/questions/76663521/where-does-py-modules-go-in-pyproject-toml-setuptools

for imdreader I have just this, which also works:

[tool.setuptools]
packages = ["imdreader"]

@lilyminium
Copy link
Member

@orbeckst no worries. I think @IAlibay is not available this weekend -- conversely I'll have time my Sunday + Monday (US weekend) to address issues. Happy to meet when @IAlibay's around again to work out priorities, but in the mean time I'll take getting the cookiecutter in better working condition to be the top priority for now?

@orbeckst
Copy link
Member Author

Yes, because of the upcoming MDA/MolSSI workshop, the cookiecutter is high priority: We are asking the MolSSI folks to use our cookiecutter template (instead of the standard MolSSI cookiecutter) for teaching the MolSSI portion of the MDA/MolSSI workshop so our version really should work.

@orbeckst
Copy link
Member Author

MANY THANKS!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants