PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 24, 2022

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

 August 24, 2022     import, importerror, module, python, python-import     No comments   

Issue

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:

  • https://realpython.com/lessons/why-cant-python-find-my-modules/

  • Installed module using pip, not found

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


Solution

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



Answered By - makansij
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing