rgerum / pylustrator

Visualisations of data are at the core of every publication of scientific research results. They have to be as clear as possible to facilitate the communication of research. As data can have different formats and shapes, the visualisations often have to be adapted to reflect the data as well as possible. We developed Pylustrator, an interface to directly edit python generated matplotlib graphs to finalize them for publication. Therefore, subplots can be resized and dragged around by the mouse, text and annotations can be added. The changes can be saved to the initial plot file as python code.
GNU General Public License v3.0
706 stars 38 forks source link

seems to be broken out of the box... #45

Closed tomstace closed 1 year ago

tomstace commented 2 years ago

I installed pylustrator on a macbook pro (intel) using pip. No problems there. Pasted the "test pylustrator" code from the documentation into jupyter lab, and got the following error. Also tried VS Code, and same result. Any idea what is happening?

image
VictorSeven commented 1 year ago

I am also affected by this error (Ubuntu 16.04, with Jupyter Lab 3.3.2). Whenever I try just to import + start, I get an error that says FileNotFoundError: '/tmp/ipykernel_9442/XXXXXXXX.py' with numbers that change every time, so I guess it is some temporal file. A transparent windows appears, immediately closes, and the notebook prints this error (but the figure is drawn). Fresh installation from today, using just pip. Is there any workaround?

rgerum commented 1 year ago

Oh I guess its a problem with jupyter lab. I only implemented it to work with jupyter notebook. It basically tries to look for the file into which to paste the code for saving and apparently does not find the file as it is not started from a file. I haven't worked with jupyter lab yet. I will look into that.

VictorSeven commented 1 year ago

I guess the error is related to that, but there the problem is not limited to Jupyter Lab, since I tried also with Notebook (version 6.4.8) and I do receive the same error. The application works fine if I try to execute it from a python script, there is no problem.

rgerum commented 1 year ago

Ah maybe it is then the bug #38 that was fixed in 225e208209465efe3324ea8b05a48daab21768b2

You can try to install the current github version with

pip install git+https://github.com/rgerum/pylustrator

and see if the bug still persists.

VictorSeven commented 1 year ago

I cannot say on the previous error because now it gives an entire different problem. EDIT: I'd say the problem comes from the way pip installs the thing, read below.

First, I had to run pip uninstall pylustrator before running the command you suggested because the version has not changed and it is still 1.1.2. This means that pip will not make any changes, so I had to uninstall first. After that I run pip install git+https://github.com/rgerum/pylustrator, installed without problem.

However, when I try to make import pylustrator now I have another error, let me paste the entire log here:

ModuleNotFoundError                       Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 import pylustrator

File ~/anaconda3/lib/python3.8/site-packages/pylustrator/__init__.py:22, in <module>
      1 #!/usr/bin/env python
      2 # -*- coding: utf-8 -*-
      3 # __init__.py
   (...)
     19 # You should have received a copy of the GNU General Public License
     20 # along with Pylustrator. If not, see <http://www.gnu.org/licenses/>
---> 22 from .QtGuiDrag import initialize as start
     23 from .helper_functions import fig_text, add_axes, add_image, despine, changeFigureSize, mark_inset, VoronoiPlot, selectRectangle, mark_inset_pos, draw_from_point_to_bbox, draw_from_point_to_point, loadFigureFromFile, add_letter, add_letters
     24 from .QtGui import initialize as StartColorChooser

File ~/anaconda3/lib/python3.8/site-packages/pylustrator/QtGuiDrag.py:38, in <module>
     35 from .drag_helper import DragManager
     36 from .exception_swallower import swallow_get_exceptions
---> 38 from .components.qitem_properties import QItemProperties
     39 from .components.tree_view import MyTreeView
     40 from .components.align import Align

ModuleNotFoundError: No module named 'pylustrator.components'

I don't know where this is coming from. Thank you for your support!

EDIT: I have checked the files downloaded and the folder "components" is missing, which seems to be the problem. This is what I have in my Anaconda installation after running the pip install for the git repo:

(base) >> ~/anaconda3/lib/python3.8/site-packages/pylustrator$ ls
arc2bez.py           drag_helper.py          icons             lab_colormap.py  pyjack.py            QtGui.py
ax_rasterisation.py  exception_swallower.py  __init__.py       parse_svg.py     QLinkableWidgets.py  QtShortCuts.py
change_tracker.py    helper_functions.py     jupyter_cells.py  __pycache__      QtGuiDrag.py         snap.py

So it is either some misconfiguration of the repo that does not grab the latest version even with the pip install git+ is called,, or it is ignoring the folders for some reason.

EDIT 2: as a workaround if I manually git clone and then copy the contents of the pylustrator folder into the folder above, where pip installed pylustrator, everything works as expected. Anyway, I think this should be fixed and updated in the pip package itself because if not there will be a big amount of users finding a problem just out of the box.

rgerum commented 1 year ago

Oh I forgot to add this subfolder to setup.py. I fixed this in commit 3137d5f. You can try the git+ installation again. And probably the --upgrade was missing from the pip install command I posted:

pip install git+https://github.com/rgerum/pylustrator --upgrade
VictorSeven commented 1 year ago

I tried reinstalling and works like a charm. Thank you so so much!!. I would either update the pip packages soon or add a warning at the README so new users don't encounter this problem just after installation :)

rgerum commented 1 year ago

I now published a new release. I hope this issue is now solved.