Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation in venv fails tests: ImportError: cannot import name 'FigureWidget' #629

Closed
NoraCodes opened this issue Mar 26, 2019 · 5 comments

Comments

@NoraCodes
Copy link

commented Mar 26, 2019

馃悶 Problem

Installing via pip in a venv fails because not all requirements are specified in the package.

When installing in a Python 3.6.7 venv using Pip 9.0.1, running ./venv/bin/python -c "import poliastro.testing; poliastro.testing.test()" fails with a bunch of tracebacks amounting to ImportError: cannot import name 'FigureWidget'.

This is the same as santosjorge/cufflinks#130.

馃幆 Goal

Poliastro doesn't work when installed from Pip, and it should.

馃挕 Possible solutions

Very easy to solve: add ipython and ipywidgets to your requirements. I have tested this solution and it works on the version I specified.

@Juanlu001

This comment has been minimized.

Copy link
Member

commented Mar 26, 2019

Hi @NoraCodes, thanks for reporting this issue!

Unless we missed something, the official way of installing poliastro with pip is

$ pip install poliastro[jupyter]

as specified in the https://docs.poliastro.space/en/stable/getting_started.html#alternative-installation-methods

(which is the only place that mentions pip)

However, I understand that people browsing PyPI will be tempted to copy paste pip install poliastro, or perhaps they just heard about the package and will try the most common thing. Therefore, rather than including those in the mandatory requirements, I think we should make poliastro work even when FigureWidget cannot be imported, by being careful with imports and skipping tests where appropriate.

@Juanlu001 Juanlu001 added the bug label Mar 26, 2019

@NoraCodes

This comment has been minimized.

Copy link
Author

commented Mar 26, 2019

Unless we missed something, the official way of installing poliastro with pip is

$ pip install poliastro[jupyter]

as specified in the https://docs.poliastro.space/en/stable/getting_started.html#alternative-installation-methods

Understood. I didn't realize that, sorry!

Is it possible that I've misunderstood the use case for the library? I'm planning to write a command line application that generates plots to image files, without ever touching an interactive interface. So far, poliastro seems to work great for this.

@Juanlu001

This comment has been minimized.

Copy link
Member

commented Mar 26, 2019

Is it possible that I've misunderstood the use case for the library?

Not at all! We are still focused on interactive visualization and easy API. But we want to make it easier for people doing "just" number crunching :)

I'm planning to write a command line application that generates plots to image files, without ever touching an interactive interface. So far, poliastro seems to work great for this.

That sounds awesome! In case it's useful, the StaticOrbitPlotter produces matplotlib images (only 2D though) so it might be a good fit. On the other hand, if you want to use OrbitPlotter2/3D, the blessed solution is probably orca:

https://github.com/plotly/orca#linux-troubleshooting-headless-server-configuration

@NoraCodes

This comment has been minimized.

Copy link
Author

commented Mar 26, 2019

Awesome, good to hear. For now StaticOrbitPlotter is working great but I'll keep Orca in mind if I need 3D plots!

@Juanlu001

This comment has been minimized.

Copy link
Member

commented Mar 26, 2019

Excellent! Please keep us posted if you publish that tool somewhere :)

@Juanlu001 Juanlu001 added this to Backlog in poliastro/poliastro Apr 26, 2019

@Juanlu001 Juanlu001 added this to the 0.13 milestone Jun 3, 2019

@Juanlu001 Juanlu001 self-assigned this Jun 10, 2019

Juanlu001 added a commit to Juanlu001/poliastro that referenced this issue Jun 10, 2019

Prevent import errors if plotting will not be used
Fix poliastro#629.
For a better error message when ipywidgets is missing,
see plotly/plotly.py#1111

@Juanlu001 Juanlu001 closed this in 33e4420 Jun 10, 2019

Sedictious added a commit to Sedictious/poliastro that referenced this issue Jun 25, 2019

Prevent import errors if plotting will not be used
Fix poliastro#629.
For a better error message when ipywidgets is missing,
see plotly/plotly.py#1111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can鈥檛 perform that action at this time.