I am on Windows 7 with Python 3.5 installed on it.
Below is what happens:
import pip # works as expected
import pip3 # results in below error
ImportError: No module named 'pip3'
I have pip and pip3.exe both sitting in the same scripts folder.
I have scripts folder, site packages and python folder all added to my environment variable path (I have added it in user profile, as I do not have admin access to add to system variables)
Is there any solution which you all have tried and worked. I am new to python and any help is appreciated.
So, I learned that my problem with installing beautifulsoup was because of the firewall restriction in my organization, which I was relating to pip install.
I learned of the proxy settings and using that, got to install bs4 via the conda interpreter.
Thank you for all the answers, which made me think through on various aspects, which I would not have thought of without the probing questions brought up here.
Related
I'm trying to use selenium, but can't get python to recognize it.
I installed it first using "pip install selenium" and "pip install webdriver-manager". It is in the folder "C:\Users\{username}\AppData\Local\Programs\Python\Python310\Lib\site-packages\selenium", but I get the error "ModuleNotFoundError: No module named 'selenium'" when I try to import it.(https://i.stack.imgur.com/dVplU.png)
(https://i.stack.imgur.com/wiREJ.png)
Here it is shown as installed with the command "pip list"
(https://i.stack.imgur.com/QhOu7.png)
I also tried uninstalling it and reinstalling with flags that I saw some people say worked, but it didn't make a difference.
(https://i.stack.imgur.com/VTTMU.png)
I only have one python interpreter version installed, 3.10 (so only one python folder, "Python310"). I have pandas in the same site-packages folder which I can import and use no problem.
If anyone knows what the issue might be, please let me know. I can't figure it out for the life of me.
Okay, I solved the issue by completely uninstalling the interpreter which I got from the Microsoft Store and reinstalling it from the official Python website. Now "from selenium import webdriver" works.
Somehow selenium installed in the global scope is not getting recognized within the Virtual Environment of VS Code / PyCharm.
Solution
You need to install Selenium within the Virtual Environment.
Within the Terminal execute the command:
pip install -U selenium
please could any one help!
Trying to import matplotlib I get this ImportError: *cannot import name 'artist' from 'matplotlib'*.
I removed the package (*py -m pip uninstall matplotlib*) and reinstall it but I still get the same error.
Thanks!
One of the common reasons why Python packages cannot be imported is because of its virtual environments. Basically when you install a package manager, it creates some root environment for you and you by default install all packages there. Now this issue may arise if you download a package into another VE, then in your code editor you should pick the one where it lies. I recommend you to check if your package is installed and pick that environment in the IDE, however from what I know it generates a different error message, something like the import couldn't be resolved. Did it help you?
I was trying to install the python chess module and kept getting the same error: ModuleNotFoundError: No module named 'chess'
I looked at some other code and noticed the same problem of not importing the module even though it worked before (in this case it was from sklearn.model_selection import train_test_split).
I figured the problem was that I put all my code in a new folder. Once I took out all of my code from this folder it was able to work, but the chess module still didn't. This made me think that it must be an issue with the path.
Since I use quite a few folders in order to organize my work. How do I fix this?
I don't want to take out all of my code from every folder I have.
I am using VSCode, and I have already installed the chess module, several times, using pip, pip3, python -m install pip, conda, in the command prompt, terminal in VSCode, and miniconda.
So it is not an installation problem.
You can install module manually,
pip install python-chess
Run this command in virtual environment, this will install python chess module
I'm in Win10 and use vanilla Python 3.7.3 (e.g. not conda or anything). I had a successful pip install for the package, the package shows up in pip freeze, and the package is supposed to be compatible with my version of Python. I've seen several threads with similar issues on OS X and Linux, and have tried to emulate their solutions on Windows, but no luck. I'm guessing it could be an issue with my PATH variable, but I'm not quite sure. The error I get when trying to import is the "No module named" error.
Went into site-packages...for some reason the module was named Bio there (everywhere else it's named biopython, again, including pip freeze) and importing that worked. Not sure if this was just a bad dev choice or what.
I am trying to install Scrapy on my computer and it has been a while since I used pip to install any libraries. Whenever I type:
pip install scrapy
into my command prompt on Windows 10 I get the error message:
Import error: No module named site
Doing a search I have found the below link:
ImportError: No module named site on Windows
with a similar issue and gone to Advanced Systems Settings and Enviromental variables, adding PYTHONHOME with C:\Python38 and PYTHONPATH with C:\Python38\Lib and C:\Python38\Scripts to both user and system variables. But I am still getting the same error message.
I have also uninstall Python and Anaconda and reinstalled them.
Does anyone know anything else I can try or any other reason pip may not be working?
You may use this way to install scrapy on your windows machine.
From http://doc.scrapy.org/en/latest/intro/install.html
Platform specific installation notes
Windows
Though it’s possible to install Scrapy on Windows using pip, we recommend you to install Anaconda or Miniconda and use the package from the conda-forge channel, which will avoid most installation issues.
Once you’ve installed Anaconda or Miniconda, install Scrapy with:
conda install -c conda-forge scrapy
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