1

I am very new to python. I am trying to use a pre-existing algorithm on my data: https://github.com/wangc29/MSIpred

I downloaded the code from GitHub and used my command line installer as suggested on the first instruction of the vignette in the above link.

I save a python file in the same directory as the downloaded code and attempt to execute the first line:

import MSIpred as mp

I receive this error:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import MSIpred as mp
ImportError: No module named MSIpred

This is my directory organization. I have tried with both MSI_Smoker and MSI_Smoker2 as seen in the image below. 1

Any suggestions?

Edit: In response to some comment, I tried moving the python script into the parent folder but I get the same error. Directory 2

  • The problem is because the Python file you are testing with is in the same directory as the downloaded code. Move the test script up one level in the hierarchy and then the `MSIpred` directory will be treated as the name of a Python package. – martineau Dec 19 '20 at 23:47
  • Thank you! I may not have executed your advice properly. I am getting the same error. – A. Basit Khan Dec 20 '20 at 00:30

1 Answers1

1

The easiest way is to add the lib path to the environment parameter PYTHONPATH(https://www.tutorialspoint.com/What-is-PYTHONPATH-environment-variable-in-Python)

export PYTHONPATH=$PYTHONPATH:`pwd`  (replace `pwd` to the lib path)

link Python error "ImportError: No module named"

ElapsedSoul
  • 725
  • 6
  • 18