'Why - after checking the python path - it still can't find my module?

I’m having difficulty getting Python to find my pip installation of the module romodel. Here’s what I’ve done so far:

  1. Checked what my python path is using which python:

    /Users/<username>/opt/anaconda3/bin/python

  2. Used that to install using pip: /Users/<username>/opt/anaconda3/bin/python -m pip install romodel

  3. Uninstalled the existing one (which probably didn’t change anything): pip3 uninstall romodel

  4. Started python, and tried to find the romodel package:

    import romodel 
    
    Traceback (most recent call last): 
    
      File "<stdin>", line 1, in <module> 
    
    ModuleNotFoundError: No module named 'romodel' 
    
    
  5. I made sure that the romodel install location is in the path:

    ls /Users/<username>/opt/anaconda3/lib/python3.9/site-packages/ |grep "romodel"

    romodel-0.0.1.dist-info

  6. So, I start python and manually add the package location to the path:

    import sys

    sys.path.append('/Users/<username>/opt/anaconda3/lib/python3.9/site-packages/')

  7. However, still no module found:

    import romodel 
    
    Traceback (most recent call last): 
    
      File "<stdin>", line 1, in <module> 
    
    ModuleNotFoundError: No module named 'romodel' 
    
    

Is there something obvious that I’m missing? Based on the resources listed below, I would have expected the above procedure to work.

I used the following resources:

And my own previous question: How to correctly uninstall numpy on MacOSX?



Solution 1:[1]

Per the instructions here: https://pypi.org/project/romodel/, I was mistakenly trying to install romodel via pip install romodel. As of May 2022, that isn't how one should install romodel.

However, the correct way to install romodel is to follow the instructions here: https://github.com/cog-imperial/romodel:

pip install git+https://github.com/cog-imperial/romodel.git

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 makansij