Pip Error Import Error: No Module Named Site
I finally have got scrapy installed on my computer and below I outline the things I had to fix and tried for anyone else having similar issues. Please feel free to correct me or inform me of any redundant steps I may include
Thanks to yabberth for answering my question his method now works on my computer, but there were a few other things I had to fix up first to get things working (many of which seem obvious now in hindsight).
Environmental Variables
My environmental variables were not set up properly for a few reasons.
to access environmental variables I just search for "View Advanced System settings" in windows 10, I then click on Environmental variables. Then I see "User Variables" and "System Variables" both of which have a field called path. path is the field I will be modifying so I double click it on both and am presented with a list of paths.
- In both I include the path to where my Python is currently installed, which unlike most people for some reason is under C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\
as well as:
C:\Users\cell\AppData\Local\Programs\Python\Python37\Scripts\
But it still wasn't working so:
- I currently have Python 3.7 installed, but previously had 3.6 and for some reason the paths for 3.6 were still there (not sure if the uninstall is meant to get rid of them or I was meant to do that). Once I deleted these pip started working again and I could install scrapy
After completing the above two steps I was able to install scrapy using windows command prompt using:
pip install scrapy
or as yabberth suggested on anaconda with
conda install -c conda-forge scrapy
Python - ImportError: No module named site
System had been trying to execute python.exe from a different source to where my new Python installation was. I believe it was trying to execute the python.exe stored with my version of PgAdmin.
Fix:
Move Python environment variables to the top of system variables
Python error ImportError: No module named
Based on your comments to orip's post, I guess this is what happened:
- You edited
__init__.py
on windows. - The windows editor added something non-printing, perhaps a carriage-return (end-of-line in Windows is CR/LF; in unix it is LF only), or perhaps a CTRL-Z (windows end-of-file).
- You used WinSCP to copy the file to your unix box.
- WinSCP thought: "This has something that's not basic text; I'll put a .bin extension to indicate binary data."
- The missing
__init__.py
(now called__init__.py.bin
) means python doesn't understand toolkit as a package. - You create
__init__.py
in the appropriate directory and everything works... ?
Related Topics
Scatter Plot and Color Mapping in Python
Finding Indices of Matches of One Array in Another Array
Python Function Attributes - Uses and Abuses
Why Is Parenthesis in Print Voluntary in Python 2.7
Setting Different Color for Each Series in Scatter Plot on Matplotlib
Matplotlib Colorbar for Scatter
Regex Matching 5-Digit Substrings Not Enclosed with Digits
How to Split a List into Pairs in All Possible Ways
How to Overload _Init_ Method Based on Argument Type
How to Export Keras .H5 to Tensorflow .Pb
Pandas Groupby Multiple Fields Then Diff
How to Write a Multidimensional Array to a Text File
How to Make a Tkinter Window Jump to the Front
Differencebetween Drawing Plots Using Plot, Axes or Figure in Matplotlib
Run Python Script Without Windows Console Appearing
Execute Multiple Commands in Paramiko So That Commands Are Affected by Their Predecessors