"No module named 'sympy'" Error. Problem occurs after installation

Question:

enter image description hereI am new to Python.
I am trying to use the Sympy package.
I am running Python 3.11 in Pycharm
I am using Windows 10.

It displays:

ModuleNotFoundError: No module named ‘sympy’

I ran pip install sympy, it installed it. And when I try reinstalling it, it displays:

Requirement already satisfied: sympy in c:usersjrkappdatalocalprogramspythonpython311libsite-packages (1.11.1)

Requirement already satisfied: mpmath>=0.19 in c:usersjrkappdatalocalprogramspythonpython311libsite-packages (from sympy) (1.2.1)

I tried going through this guide
https://bobbyhadz.com/blog/python-no-module-named-sympy
but it did not work.

I tried uninstalling it and reinstalling it
both with pip and mpip
it unfortunately didnt work

at the top you can see which interpreter i am using

I can see that there is a file called sympy in my downloads folder, maybe that has to be relocated, but where to?

Asked By: Jakob Karlsen

||

Answers:

Try Uninstalling it and reinstalling

pip uninstall sympy

pip install sympy

Answered By: For Cc

My instructions might be a bit rusty as I don’t regularly use Windows for Python but here goes:

You’ll notice that the path to your Pycharm Python interpreter (c:UsersjrkPycharmProjects..) is different than the path reported by pip in your error messages (c:Usersjrkappdata..).

It’s perfectly normal to have multiple versions of Python around, but you’ll need to be a bit careful about which one you’re invoking.

It’s unclear from your description where exactly you are running the pip commands, but usually if you open built-in terminal in Pycharm, it most likely has the right virtual environment activated automatically. The command line prompt should begin with (venv) if that is the case. If you then run pip install sympy you ought to have it installed in the correct place.

If you’re using a regular command prompt, you can also manually activate the virtual environment by running the activate or activate.bat file that you’ll find in c:UsersjrkPycharmProjectspythonProjectvenvScripts folder.

Might want to also read a bit about virtual envs @ https://docs.python.org/3/library/venv.html

Answered By: voneiden

I found the solution. I do not know why it worked. But i moved the project from the local file on my computer to the server we use in our company, and then it worked

Answered By: Jakob Karlsen
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.