0

When I create a python project in PyCharm on my own and run a python file than have a line

import cplex

the import works fine. However, if I clone the project from GitHub the same line of code is not working and I get

No module named 'cplex'

error.

SOLUTION ATTEMPT

First thing that I verify in the clone project was the 'project interpreter' but after setting it to the same interpreter as in the original project I still get the same error.

What are the other meta-params of the project that I should change to get cplex working?

Snochacz
  • 685
  • 1
  • 8
  • 23
  • its not using the right interpretter ... I know you say it is ... but its not – Joran Beasley Mar 16 '21 at 17:34
  • I 've checked with print(sys.executable) within the same .py file, and its the right one – Snochacz Mar 16 '21 at 17:40
  • 1
    you could try comparing sys.path and os.environ["PYTHONPATH"] ... but i do not believe that the interpretters are the same still ... the only reason the othe things I suggested would be broken is if you went and tried to manually change them... also it might be worth trying to use a virtualenvironment – Joran Beasley Mar 16 '21 at 18:23
  • another possibility is that you have a folder named cplex or something that its trying to import instead of the package ... – Joran Beasley Mar 16 '21 at 18:24
  • You have to diagnose if the package/modules are available available in `sys.path` see [question 1](https://stackoverflow.com/questions/1893598/pythonpath-vs-sys-path) or [question 2](https://stackoverflow.com/questions/16114391) or [question 3](https://stackoverflow.com/questions/54871891). Your question doesn't have enough info to understand what the exact problem is, and believe me every day this same question is asked in all kinds of ways. The best we can do for you at this point is recommending to diagnose the problem as indicated in the threads and edit the question to include more info. – bad_coder Mar 16 '21 at 18:40
  • [This thread](https://stackoverflow.com/questions/21199382) is specific to PyCharm and it's very good. – bad_coder Mar 16 '21 at 18:46

0 Answers0