pythonpycharmgmpy

PyCharm can't locate gmpy2 (unresolved reference)


I'm using Ubuntu 16.04 and just need a downloaded simple encryption script in python to run.

I installed pyCharm to run the scripts but its giving unresolved reference errors at gmpy2

The script is using gmpy2 which I installed using the command: sudo apt-get install python-gmpy2.

And apparently it worked as the following command managed to search for it:

 pip search gmpy2
gmpy2 (2.0.8)  - GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x
  INSTALLED: 2.0.7
  LATEST:    2.0.8

But in PyCharm, this line is unable to locate it:

from gmpy2 import mpz, powmod, invert, is_prime, random_state, mpz_urandomb, rint_round, log2, gcd 

giving error: unresolved reference `gmpy2`


Solution

  • It's possible that you've configured PyCharm to use a custom Python environment for your script. Check you project settings (File - Settings - Project - Project Interpreter) and see if gmpy2 is listed in the installed packages. If not, you can add it to your project's environment on the same page or change to a default interpreter in /usr/bin