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.
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
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
I've been trying to install simple packages for python such as numpy and pandas, and while I am able to install the package manually from the command line using pip as soon as I try to import it PyCharm can't find it. I have manually configured the path, with no luck.
PyCharm can also not find the packages I want to install itself and produces a connection timeout, this could be because I am working from a secure network.
Still pretty new to python and software dev in general, I apologise in advance if I'm being stupid, but no other similar threads are solving the issue.
I am operating on windows 7. The error I get is:
C:\Users\james.alexander\PycharmProjects\Test.py\venv1\Scripts\python.exe C:/Users/james.alexander/PycharmProjects/Test.py/testfile.py
Traceback (most recent call last):
File "C:/Users/james.alexander/PycharmProjects/Test.py/testfile.py", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
I think PyCharm use a virtualenv, installing via pip won't work since it will install the package in your local env.
Check https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html
Try This:
Step 1: Ctrl+Alt+s
Step 2: Look for Project Interpreter Under Project
Step 3: Look for + In the right corner of prompt box.
Step 4: Search and select your required package. And Install button is just below.
First check the Project Interpreter in your pycharm.
File > Settings >Project >Project Interpreter
Check the version of python there (python2 or python3)
And check if you are using any virtual environment
And see what version python you have installed
For python3 you may have to use "pip3 install pkgname"
For python2 use "pip install pkgname"
In PyCharm, you can install modules from within the app. Simply access your preferences, then under 'Project Interpreter', you will find a table containing your installed modules. To install a new one, click the + symbol on the bottom - left, then search for the appropriate package, e.g. numpy. Once you've found it, simply click 'Install Package'. The module is now installed and ready to use!
EDIT: I've just seen that someone else has already posted this answer, sorry about that :)
I am getting an error message that says "no module named xlutils.copy". When I got to do the pip install of xlutils.copy I get an error message "could not find a version that satifies the requirement". I downloaded xlutils 2.0.0 which contains xlutils.copy but I am not sure if it needs to be put in a certain directory?
from xlrd import open_workbook
from xlutils.copy import copy
rb = open_workbook('Excel FDT Master_01_update.xlsx')
wb = copy(rb)
s = rb.sheet_by_name('INPUT')
r = 5
for test in col_test:
s.cell(rowx = r, colx = 1).value = test
r += 1
wb.save('comeonenow.xls')
Perhaps you have multiple installations of Python, and the pip installed the xlutils in a different installation. If you try just:
import xlutils
I expect you'll get the same results as before. I feel this may be getting overlooked by some of the other posters. Your error message says it can't find the xlutils module, not some submodule or variable. Is this still the case?
When you have multiple installations of Python, only one is the "default", so to speak, and any module installations will install into that default Python installation. I am careful to only run two installations: Python 2.7 and 3.6. And I go into each installation and make sure that I have a pip2 and a python2, and a pip3 and python3, so that I can just reference directly to the Py version I want to use, either to run or to install new packages. Otherwise, if I just run pip, I'm not 1000% sure where it will go. (Okay, I'm exaggerating. I know Python 2 is my default. Just trying to make a point.) :)
Also, just because you think you only have one Python installation, that may not be the case. On Windows, yes. But on Mac, there is a preloaded Python installation, and updating the Python and getting new packages into the new version instead of the preloaded version can be tricky, depending on what you've done. Also, when you install an IDE like PyCharm, it wants to install a Python version, as well.
Last comment -- Sometimes (not usually but sometimes), an installed package will have a different name than you would think. That is not the case with xlutils. But, with fonttools, you install fonttools but you must import fontTools (note the capital 'T') into your Py script. Again, not the case with xlutils, but just be aware of this for the future.
I am a total newbie to python. I am using docker as my virtual environment.
I am trying to run this line of code on ipython
pivot_df.to_excel(os.path.expandvars('/home/user/code.xlsx'))
and I am getting the following error:
ImportError: No module named openpyxl
I installed openpyxl successfully and then tried to import openpyxl again on ipython but with no success.
Will I have to refresh my ipython session for the openpyxl to work? If yes, how do I do that? Will I lose everything I ran until now if I do that?
I don't think you need to reload as such, so import should work after you installed a package.
It may be related to some python path of virtual environment issue. Where you installed package in one python and ipython is running in another configuration.
Best thing is to execute ! pip install openpyxl from ipython itself. This will make sure you install the package in correct environment. Then it should work