Why xlsxwriter module does not work like other modules? - python-2.7

Traceback (most recent call last):
File "F:TC.py", line 1, in <module>
import xlsxwriter
ImportError: No module named xlsxwriter
I am getting this error even after trying every possible answer given to this problem earlier.
I am using python 2.7 in windows
I have installed xlsxwriter using pip
I have tried reinstalling python shell but it doesn't work.

Related

PyDSTool with anaconda not installing properly

I am trying to install PyDSTool with anaconda2 (conda install PyDSTool), which seems to go well. But when I open spyder and import PyDSTool, it gives me error
import PyDSTool
Traceback (most recent call last):
File "<ipython-input-1-a214100b00aa>", line 1, in <module>
import PyDSTool
File "/home/user/anaconda2/lib/python2.7/site-packages/PyDSTool/__init__.py", line 76, in <module>
raise RuntimeError("SciPy v0.5.1 or above is required")
RuntimeError: SciPy v0.5.1 or above is required
I tried to change parseUtils.py as per this suggestion: import of package PyDSTool doesn't work
but still the same error. I certainly have SciPy 1.0 and python 2.7.
I ran into this problem recently. The accepted answer here (PyDSTool do not recognize SciPy version) is still effective today at solving this problem.
Basically download PyDSTool from here (https://github.com/tkf/pydstool/tree/tkf) instead of sourceforge.

numpy and pandas breaking after installing biopython on spyder anaconda

I'm using spyder 2 anaconda 2.3.0 on windows as a python IDE for python 2.7. I've been using this for a long time to code in python but suddenly I don't know what happened and it said I did not have biopython package installed, when I installed biopython using
conda -c install anaconda biopython
command, biopython started running however it broke pandas and numpy.
now when I import pandas I get this:
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\pandas\__init__.py", line 13, in
<module>
"extensions first.".format(module))
ImportError: C extension: hashtable not built. If you want to import pandas
from the source directory, you may need to run 'python setup.py build_ext --
inplace' to build the C extensions first.
and then when I import numpy I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Anaconda\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Anaconda\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Anaconda\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Anaconda\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
I uninstalled numpy and pandas and then installed them back using pip ... still the same. I entirely unistalled anaconda and installed it back still the same errors. I really do not know what's causing this. Any help will be truly appreciated. I've been trying to fix this for the past three days and its not working out. Thanks for your time.

Already installed Pygame module, but when try to run pygame code it shows error

Traceback (most recent call last):
File "game.py", line 6, in
import random, pygame, sys
ImportError: No module named pygame
im no expert but from my experience but make sure you downloaded the right pygame for 1. your version of python and 2. your system+(32/64 bit).
also make sure in your path you have c:\python27 , c:\python27\scripts.

How can I import the csvsql to Python 2.7

I have successfuly installed csvkit using conda install ...
However, when I try to import the libraries in Python 2.7 Spyder, I get error messages:
import csvsql
Traceback (most recent call last):
File "<ipython-input-5-303a60a6b1ac>", line 1, in <module>
import csvsql
ImportError: No module named csvsql
import csvkit
Traceback (most recent call last):
File "<ipython-input-7-ca8a99ae9834>", line 1, in <module>
import csvkit
ImportError: No module named csvkit
I looked at the documentation -- they describe the installation process but not how the library is loaded in Python.
Moreover, I had an analogous problem with httplib2. I installed it successfuly but when I tried to import it in Spyder I received an analogous error message (No module named httplib2).
(I use Anaconda 3 and Spyder on Windows 11)
Any ideas? Thank you in advance.
I asked this question on the csvkit GitHub / issues forum.
The answer given was: You should use agate on which csvkit now relies for all its operations. See https://github.com/wireservice/agate.
I'm with you -- it would be wonderful to use csvkit as a command-line tool and a library, but it's authors don't see it that way. The full issue: https://github.com/wireservice/csvkit/issues/670

dispersion_plot not working inspite of installing matplotlib

i have installed matplotlib using pip in ubuntu 14.04 LTS.. but on running dispersion_plot this is showing the following error ..
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/nltk/text.py", line 455, in dispersion_plot
from nltk.draw import dispersion_plot
ImportError: cannot import name dispersion_plot
I am new to python... can anyone suggest if there is a better way of installing matplotlib in nltk.
The examples of the online book are not quite right.
You may try this:
from nltk.draw.dispersion import dispersion_plot
words = ['Elinor', 'Marianne', 'Edward', 'Willoughby']
dispersion_plot(gutenberg.words('austen-sense.txt'), words)
You may also call it from a text directly:
from nltk.book import text1
from nltk.draw.dispersion import dispersion_plot
dispersion_plot(text1, ['monstrous'])
this way you import the function directly instead of calling the funcion from text object.
I realized this watching at the source code directly.
Hope this work for you
After importing it using spyder, this is how the plot would look.