I've BeautifulSoup4 installed in my system but when I import it, I get thrown an error No module named 'beautifulsoup4'. I just installed this module as shown in the screenshot attached. .
In addition, I've tried the regular pip install method to install BeautifulSoup4 but same issue.
Maybe you are not in the version you installed beautifulSoup4. Try positioning yourself in the python version you intalled it.
try changing the version you are working on with in visual:
Look for this, and click it
you may have two options like so:
select the one you are not positioned in
Related
I just installed camelcase using the pip command on my cmd.
When I try pip list, the module is present but when I try to import it to my text editor, it tells me that it does not exist.
I installed another module and I was able to import it.
I’ve tried uninstalling and reinstalling it again but it’s not still working.
Which code editor are you using? In my case when I had similar problems with installing packages I tried installing them directly from terminal in my PyCharm app. For me it worked out perfectly.
Make sure you are importing the right class.
from camelcase import CamelCase
So I was trying to use a ttk theme named "Sun Vally" (Link) But when I tried to use it, it gave an error of "ModuleNotFoundError: No module named 'sv_ttk'" even though I already have pip installed it.. I am still new to all this.. thanks in advance!
For starters, try running the command pip list in your terminal. Does the module sv_ttk 1.0 appear in the list? If not, you may need to try running pip install sv-ttk again. This also assumes you aren't using a Python virtual environment, but I imagine you aren't.
You may also want to check if the module is properly installing into your site packages directory (the location of which is platform dependent). Are you on Mac OS or Windows?
Please update this question with a minimal example of what you've already tried so we can help you further.
IF FIGURED IT OUT! I was using cmd to install pip but never realized I needed to use a different terminal... Turns out PyCharm has its own terminal and wont work if you used a different one...
I recently downloaded the xlsxwriter version 0.6.4 and installed it on my computer. It correctly added it to my C:\Python27\Lib\site-packages\xlsxwriter folder, however when I try to import it I get the error ImportError: No module named xlsxwriter. The traceback is File "F:\Working\ArcGIS\ArcGIS .py\Scripts\Append_Geodatabase.py".
However if I try to import numpy (I can't remember what numby is, however it is located in the same site-packages folder C:\Python27\Lib\site-packages\numpy) it has no problem.
Any idea of what could be causing this issue?
Thanks for the help.
Here are some easy way to get you up and running with the XlsxWriter module.The first step is to install the XlsxWriter module.The pip installer is the preferred method for installing Python modules from PyPI, the Python Package Index:
sudo pip install xlsxwriter
Note
Windows users can omit sudo at the start of the command.
Even if it looks like the module is installed, as far as Python is concerned it isn't since it throws that exception.
Try installing the module again using one of the installation methods shown in the XlsxWriter docs and look out for any installation errors.
If there are none then run a sample program like the following:
import xlsxwriter
workbook = xlsxwriter.Workbook('hello.xlsx')
worksheet = workbook.add_worksheet()
worksheet.write('A1', 'Hello world')
workbook.close()
I have the same issue. It seems that pip is the problem. Try
pip uninstall xlsxwriter
easy_install xlsxwriter
I managed to resolve this issue as follows...
Be careful, make sure you understand the IDE you're using! - Because I didn't.
I was trying to import xlsxwriter using PyCharm and was returning this error.
Assuming you have already attempted the pip installation (sudo pip install xlsxwriter) via your cmd prompt, try using another IDE e.g. Geany - & import xlsxwriter.
I tried this and Geany was importing the library fine. I opened PyCharm and navigated to 'File>Settings>Project:>Project Interpreter' xlslwriter was listed though intriguingly I couldn't import it! I double clicked xlsxwriter and hit 'install Package'... And thats it! It worked!
Hope this helps...
sudo pip install XlsxWriter
Make sure that X and W are in uppercase.
I am not sure what caused this but it went all well once I changed the path name from Lib into lib and I was finally able to make it work.
I installed it by using a wheel file that can be found at this location:
https://pypi.org/project/XlsxWriter/#files
I then ran pip install "XlsxWriter-1.2.8-py2.py3-none-any.whl"
Processing ./XlsxWriter-1.2.8-py2.py3-none-any.whl
Installing collected packages: XlsxWriter
Successfully installed XlsxWriter-1.2.8
in VSCode:
instead of activating your environment with script use python select interpreter
from VSCode(press ctrl + shift + p)
and then select your environment from the list (marked with recommended)
I found the same error when using xlsxwriter in my test.py application. First, check if you have xlsxwriter module installed or not.
sudo pip install xlsxwriter
Then check the python version you are using, The following worked for me
python2 test.py
Using this on Raspberry Pi 4. I had a similar issue. I followed the install step:
sudo pip install xlsxwriter
None of the IDEs could find the module. I had to use Add/Remove Software under preferences in the GUI, search for xlsxwriter, select one by clicking on it and make sure the box is checked, and then click apply, then select the other one (it showed two for me) and click apply for that one. After that, it worked fine.
I have trouble with Pycharm recognizing installed modules. I'm using Pycharm 2018.2.4 CE with Python 3.7 x64, on Windows 10. I don't have Python 2.x installed. I installed requests and BeautifulSoup4 from command line using 'pip' and 'pip3' commands. Pip list and Pycharm is seeing installed module in interpreters list but when I enter my code is grayed out like none of those were installed:
Grayed out code
Interpreter settings
I tried everything - reinstalling both Python (x64 and x86) and Pycharm, installing/upgrading/uninstalling BeautifulSoup4 and bs4, I also tried every solution I could find on stack or google, seems like few people had similar issue but no one gave them any final answer. Does anyone know how to fix this under Windows 10?
See if this helps:
Go to the following path:
File/ Settings/ Project: Project_Name/ Project Interpreter
Click on the plus sign on the right, find the module there and install it.
Also, if they are gray, it's because you have imported them but haven't used them yet. The only one which might have a problem is the last one with the red lines maybe.
This was discussed here
Also, below should be changed
from bs4 import BeautifulSoup
I'm starting to learn about python development in a new project.
I got setup almost everything right, but only this import HTML that keeps given me some error that I don't know how to solve it.
import web
import json
from WebServer.forms import mainPageForm, addBugForm, addProblemForm, addProblemTypeForm, versionsDropdownForm,\
severitiesDropdownForm, problemTypesDropdownForm, problemsDropdownForm
import BugRecorderCore.controller as ctrl
import BugRecorderCore.validators as vdt
import datetime
import os
from BugRecorderCore.utils import concatenateString
import HTML
//...
I already tried to install HTML.py already, but still no success so far.
Any idea or advice about this issue ?
UPDATE
Following the suggestions from the answers below I got this message:
It looks like you are using anaconda, have you tried installing it the anaconda way?
conda install HTML
Also do you by any chance have 2 version of Python on your system?
If the package is unavailable you'll have to user pip. If you don't have pip, from your command line write:
python get-pip.py
pip install HTML
Looking the given screenshots and tags I suppose your are using Anaconda (which I have no experience but it is still Python, anyway) and the IDE is not resolving the import.
Make sure you have installed/updated HTML.py
conda install HTML
At your IDE go to Window > Preferences > Python Interpreter
At Libraries tab make sure you have the following folders added to your PYTHONPATH:
C:\Anaconda\Lib
C:\Anaconda\Lib\site-packages
C:\Anaconda\Scripts
That should do the trick.
Important: try to always install your libraries through conda (or pip when using Python directly). It will install things where it should be. ;)