Module error

Thomas Passin list1 at tompassin.net
Fri May 26 23:49:01 EDT 2023


On 5/26/2023 8:30 PM, giuseppacefalu at gmail.com wrote:
> I have reinstalled python which reinstalls pip.  I have added the
> path:'C:\sers\Giuseppa\AppData\Local\Packages\PythonSoftwareFoundation.Pytho
> n.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts and still
> get the error below. Could you help me with this please?
> 
>   
> 
> Traceback (most recent call last):
> 
>    File "C:\Users\Giuseppa\Documents\DataScience\PYTHON\Subsetting.py", line
> 11, in <module>
> 
>      import pandas as pd
> 
> ModuleNotFoundError: No module named 'pandas'
First of all, did you install Python from the Microsoft Store or using 
the Python installer from python.org?  The python.org installer does not 
use paths like that.  In case of problems, I think it would be 
preferable to install using the python.org installer.

Second, after an install of Python, you need to install any packages 
that are not standard Python modules and libraries.  Pandas is not part 
of a standard Python installation, so you would have to re-install it. 
Changing the Windows path has nothing to do with it.  Install pandas with

<python> -m pip install pandas --user

where <python> is the actual command that you use to run the version of 
Python you want to work with.

You can find out if your version of Python is running out of that 
LocalCache directory or not by running the following from the command 
line in a console:

<python> -c "import sys;print('\n'.join(sys.path))"

Again, <python> represents your actual "python" command.

You will get a display something like mine (I'm not showing the entire 
listing):

C:\Users\tom\AppData\Local\Programs\Python\Python311\python311.zip
C:\Users\tom\AppData\Local\Programs\Python\Python311\DLLs
C:\Users\tom\AppData\Local\Programs\Python\Python311\Lib
C:\Users\tom\AppData\Local\Programs\Python\Python311
C:\Users\tom\AppData\Roaming\Python\Python311\site-packages

You see that in my case, there is no LocalCache directory involved.  I 
installed using the installer from python.org.


More information about the Python-list mailing list