I want to create a histogram with broken axes and found that there must be a module doing this called brokenaxes that works together with matplotlib (source) .
Anyway, when I trie to import the module like this:
import matplotlib.pyplot as plt
from brokenaxes import brokenaxes
I get this error message:
No module named brokenaxes
I'm using ipython5.1 in anaconda 4.3.
Can anyone help me?
In order to use a module it has to be installed. This can be done via
pip install brokenaxes
See https://docs.python.org/3/installing/
However, it seems that the brokenaxes you get from the python package index is currently (as of June 2017) broken (as the name says it ;-)). It should now (as of August 2017) be working again (see answer by package maintainer below).
Alternatively
go to https://github.com/bendichter/brokenaxes, download the files and copy
brokenaxes.py into your python's site-packages folder.
Package creator here. There was a bug in the install script. It worked despite the bug in previous versions of pip, but if you have the most recent version the install broke. I fixed it today, so you should be able to run:
pip install brokenaxes==0.2
to get the latest version. Sorry for the inconvenience and thanks for bringing this to my attention.
Ben
Related
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 want to build a Ordered Probit model using statsmodel package in python. Used the following code to import:
from statsmodels.miscmodels.ordinal_model import OrderedModel
but getting a following error:
ModuleNotFoundError: No module named 'statsmodels.miscmodels.ordinal_model'
I have updated the package as well but the error persists.
well,u can install this package in this way:
pip install git+https://github.com/statsmodels/statsmodels
pip install --upgrade --no-deps statsmodels worked for me.
I know it is a pretty old discussion board, but I hope my post can be helpful.
I recently ran into the same issue. and solved by doing the following:
pip3 install git+https://github.com/statsmodels/statsmodels. Just like #AudiR8 mentioned. However, if you are using an IDE with python version 3.0 +, use pip3 is better.
Make sure the package is installed in the correct directory then turn off the IDE.
Reopen it and it should be working.
Hope it can be helpful!
An option that helped me was to restore my console's settings to default and then it worked. My IDE in particular was Spyder
You can try use this instead from statsmodels.discrete.discrete_model import OrderedModel
I have already installed my wanted module from pip by using pip install but when i open up a program in idle and put import menu it says module not found what did i do wrong, im using python 3.7 and have the latest version of pip.
Python looks for its modules and packages in $PYTHONPATH. You'll need to figure out if the __init__.py module of the package you'd like to use is in python's path. To find out whether it is in python's path, run:
import sys
print(sys.path)
within python.
To add the path to your module, run:
sys.path.append("/path/to/your/package_or_module")
and you should be set.
I met the same problem, but in my case the package is created by myself. So this answer applyes to the custom packages. See Why customer python package can not be imported? for details.
Just in case someone is meeting a similar problem to mine.
Pay attention to the case of the package. In my case, the package is called 'shapely'. And I installed it through
pip install Shapely
But you have to import as
import shapely
on 64bit win 7, I installed all of compatible versions of setuptools, numpy, python-dateutil, pytz, pyparsing and six in addition to matplotlib. I did this by downloading source into a folder, and installing from source ... for example,
python setup.py install
finally, I installed python matplotlib by,
cd matplotlib
python setup.py build
python setup.py install
I tested matplotlib by running python from my windows powershell, and typing import pylab I got error:
ImportError: error importing numpy: you should not try to import numpy from its source ...
I found a stackoverflow question that addressed this, leading answer was to change working directory from the directory where numpy lives.
I changed the working directory to another folder in my drive, again ran python from my interpreter, typed import pylab and received this error:
ImportError: NO module named numpy"
I am now at a loss. It either refuses to import numpy, or says it doesn't exist? But it knew it existed earlier?
Ive been looking for a solution for more than three hours now, am stumped. Apologies in advance if this question seems too noob.
finally, I am open to trying a different module if it would be easier. I only want to plot some data.
I'll preface by saying I'm a programming n00b by stack standards. I have experience with data analysis and scripting -- this is what I do professionally at a financial firm -- but I have no idea what I'm doing on the back end.
I'm trying to start using pandas and python --- moving away from matlab/vba but I can't figure out how to install the pandas library.
When I try to import pandas I get an error that numpy module is not present. I tried to install ezsetup / pip (no idea what this is btw)... and I have no idea where to enter this command$ python get-pip.py
Sometimes when I try to import pandas I get an error cannot import name table hashable
I have no idea what any of this means and I am not getting anywhere.
Update
Ok I installed anaconda and it seems to be allowing me to import numpy and pandas directly from the console. That being said when I try to write a basic time series and plot it using pandas syntax, i get an error that "series is not defined" as such I'm not sure if it is actually working
In [1]: import matplotlib.pyplot as plt
In [2]: ts = Series(randn(1000), index=date_range('1/1/2000', periods=1000))
In [3]: ts = ts.cumsum()
In [4]: ts.plot()
The best resource for third-party modules for Windows is Christoph Gohlke's Python Extension Packages for Windows repository. Each module is available as a self-extracting .exe installer, for use with the python.org version of Python - make sure you get the correct installer for your version and architecture.
While NumPy does not require any other packages, pandas does, so make sure you get them all. The installation order is not important.
The advantages of this resource over a distribution like Anaconda or Enthought is that Dr. Gohlke keeps the packages very up to date, allowing you to run the latest versions of the modules. Additionally, nearly all of the modules have multiple Python versions, while some of the other distributions are only based on Python 2.7.
The disadvantage is that you need to install each package individually, and there is no package manager for handling dependencies.
Best to use a pre-packaged solution, Anaconda or Enthought particularly with windows
Try this: It should work.
Go to the location where you have Python (C:\Python34)
Run the blow command:
python -m pip install pandas
NUMPY installed automatically after my Pandas installation.
I had the same headaches and the solution I finally found was to install python xy. This seems to include every package I have ever dreamed of using, and weeks of frustration evaporated almost instantly (related to pandas and many others. It's a great collection of everything you will need. It includes most all of the libraries mentioned above)
While YMMV, Enthought's Canopy caused issue after issue after issue for my installation. I advise to steer clear.
First upgrade pip version using command python -m pip install --upgrade pip after that just do pip install pandas
Note : - For pandas python-dateutil, numpy, setuptools and pytz module required.
To install pandas for Python 3, you may need to use the python-pandas package.
While NumPy does not require any other packages, pandas does, so make sure you get them all. The installation order is not important. ... The disadvantage is that you need to install each package individually, and there is no package manager for handling dependencies.
To Install numpy pip install numpy
To install pandas pip install pandas