Anaconda Prompt finds libraries, cmd -> Python doesn't. Python was only installed with Anaconda package, nothing else

Viewed 2770

I'm not sure what's going on here. I installed Python with Anaconda, there are no previous versions of Python installed. Everything works fine with Spyder, Jupyter Notebooks, or within Anaconda prompt itself. When I try to run numpy or pandas in cmd, I get an error. When I run them in Anaconda prompt, no issue.

Here's how it looks in Anaconda prompt

How it looks in CMD

Looks like both prompts are pointing to the exact same installation of Python. I've even ran python.exe from the Anaconda install folder and get the same error.

My Environment Variable path points to C:\Anaconda , where the python.exe is found. Any ideas as to what's going on?

Edit: I noticed I import numpy on the conda screenshot and I'm trying to import numpy on the cmd screenshot. Importing either pandas or numpy on conda loads it successfully.

Edit 2: Opening python.exe within the Anaconda folder gives the same output. Can't import numpy/pandas. Opening Anaconda Navigator -> base (root) -> Open with Python successfully imports numpy/pandas. How can the python.exe within Anaconda not detect libraries installed by Anaconda... yet running Python within Anaconda Navigator works?

Edit 3: SOLVED Ended up uninstalling and reinstalling both Pandas and Numpy through Anaconda prompt. Really odd but now both packages work regardless if I use Conda prompt or cmd.

1 Answers

Try upgrading the pip first and then try to uninstall if they are already present in the below order.

pip uninstall pandas
pip uninstall numpy
pip install pandas
pip install numpy
Related