question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on import when using Python 3

See original GitHub issue

I installed plotnine in Python 3 using the command pip install plotnine.

Running python -c "from plotnine import ggplot" yields the error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/__init__.py", line 3, in <module>
    from .qplot import qplot            # noqa: F401
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/qplot.py", line 11, in <module>
    from .ggplot import ggplot
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/ggplot.py", line 17, in <module>
    from .facets import facet_null
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/facets/__init__.py", line 3, in <module>
    from .facet_grid import facet_grid
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/facets/facet_grid.py", line 10, in <module>
    from .facet import facet, layout_null, combine_vars, add_missing_facets
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/facets/facet.py", line 13, in <module>
    from ..scales.scales import Scales
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/scales/__init__.py", line 4, in <module>
    from .scale_alpha import scale_alpha
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/scales/scale_alpha.py", line 9, in <module>
    from .scale import scale_discrete, scale_continuous, scale_datetime
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/plotnine/scales/scale.py", line 18, in <module>
    from mizani.transforms import gettrans
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/mizani/transforms.py", line 431, in <module>
    _doc='Logit Transformation')
  File "/Users/dan/anaconda/envs/py35/lib/python3.5/site-packages/mizani/transforms.py", line 407, in probability_trans
    raise ValueError(msg.format(distribution))
ValueError: Unknown distribution 'logistic'

It installs and loads fine from a Python 2 environment.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
has2k1commented, Oct 28, 2017

As far as I can tell, scipy 0.18.1 is not the problem. It may have been a case of mixed up packages.

This works for me:

# In a new virtual environment
$ pip install scipy==0.18.1
$ pip install plotnine
$ python -c "from plotnine import ggplot"

Even checking the scipy code, the logistic function is present in v0.18.1 and in much older versions.

I did not set a minimum version of scipy because it has not always been easy to install on all platforms. v1.0.0 may have changed that but I am not sure if that will always be the case.

0reactions
has2k1commented, Oct 28, 2017

It is not necessary to chase down the root cause, unless you run into it again. Leave the PR open, I’ll look more into the availability of v1.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python error "ImportError: No module named" - Stack Overflow
So, I set PYTHONPATH per Import statement works on PyCharm but not from terminal: export PYTHONPATH=$PYTHONPATH:`pwd` (OR your project root directory).
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
ModuleNotFoundError: no module named Python Error [Fixed]
How to fix the ModuleNotFoundError in Python · 1. Make sure imported modules are installed · 2. Make sure modules are spelled correctly...
Read more >
Python Import Error (ModuleNotFoundError) - Finxter
Python's ImportError ( ModuleNotFoundError ) indicates that you tried to import a module that Python doesn't find. It can usually be eliminated by...
Read more >
Understanding the Functions of ImportError in Python - eduCBA
In Python, ImportError occurs when the Python program tries to import module which does not exist in the private table. This exception can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found