alopezrivera/mpl_plotter

Alexandria Package not Found while doing pip install

Closed this issue · 4 comments

I installed the library using pip (python 3.6.9) but while doing the import using from mpl_plotter.two_d import line I get the following error:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-24-3ba9be32d00b> in <module>()
----> 1 from mpl_plotter.two_d import line

/home/svyas/.local/lib/python3.6/site-packages/mpl_plotter/two_d.py in <module>()
     13 
     14 from mpl_plotter.methods.mock_data import MockData
---> 15 from Alexandria.general.console import print_color
     16 from Alexandria.constructs.array import span, ensure_ndarray
     17 

ModuleNotFoundError: No module named 'Alexandria'

Either Alexandria should be installed via requirements automatically while installing via pip if it is a necessary library for using mpl_plotter or removed if it is not necessary?

Hey! Thanks for the heads up!

I've run the following test on a blank Python 3.7.4 (both libraries are available for Python >= 3.6, so I believe the version difference should not be the cause of the issue) virtual environment and it seems to work fine:

>> pip install mpl_plotter --upgrade
>> python
>> from mpl_plotter.two_d import line
>> line(show=True)

I can't exactly pinpoint the root cause of the error, but it might be a version conflict between both libraries, as I've changed the Python-Alexandria API very significantly in the past weeks.

Importantly, MPL Plotter >= 4.0.0 requires Python-Alexandria>=2.0.0. When installing it in a blank virtual environment the most recent versions of both are installed, which explains why it would work on my side.

I've just published a new release updating the setup.py so that Python-Alexandria>=2.0.0 is automatically installed when upgrading mpl_plotter from an older version.

Let me know if that solves it for you :)

I did a full reinstall of mpl_plotter and Python-Alexandria. Still have this error:

>>> from mpl_plotter.two_d import line Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/svyas/.local/lib/python3.6/site-packages/mpl_plotter/two_d.py", line 15, in <module> from Alexandria.general.console import print_color ModuleNotFoundError: No module named 'Alexandria'

Output from pip install mpl_plotter --upgrade:

svyas@ISG-T480s-L1-U:~$ pip install mpl_plotter --upgrade
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: mpl_plotter in ./.local/lib/python3.6/site-packages (3.9.2)
Requirement already satisfied: Python-Alexandria in ./.local/lib/python3.6/site-packages (from mpl_plotter) (2.0.0)
Requirement already satisfied: numpy in ./.local/lib/python3.6/site-packages (from mpl_plotter) (1.19.5)
Requirement already satisfied: matplotlib in /usr/lib/python3/dist-packages (from mpl_plotter) (2.1.1)
Requirement already satisfied: coverage-badge in ./.local/lib/python3.6/site-packages (from mpl_plotter) (1.0.1)
Requirement already satisfied: scikit-image in ./.local/lib/python3.6/site-packages (from mpl_plotter) (0.17.2)
Requirement already satisfied: PyQt5 in ./.local/lib/python3.6/site-packages (from mpl_plotter) (5.15.4)
Requirement already satisfied: coverage in ./.local/lib/python3.6/site-packages (from mpl_plotter) (5.5)
Requirement already satisfied: pandas in ./.local/lib/python3.6/site-packages (from mpl_plotter) (1.1.5)
Requirement already satisfied: termcolor in ./.local/lib/python3.6/site-packages (from mpl_plotter) (1.1.0)
Requirement already satisfied: python-dateutil>=2.7.3 in ./.local/lib/python3.6/site-packages (from pandas->mpl_plotter) (2.8.2)
Requirement already satisfied: pytz>=2017.2 in ./.local/lib/python3.6/site-packages (from pandas->mpl_plotter) (2021.1)
Requirement already satisfied: six>=1.5 in ./.local/lib/python3.6/site-packages (from python-dateutil>=2.7.3->pandas->mpl_plotter) (1.16.0)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in ./.local/lib/python3.6/site-packages (from PyQt5->mpl_plotter) (12.9.0)
Requirement already satisfied: PyQt5-Qt5>=5.15 in ./.local/lib/python3.6/site-packages (from PyQt5->mpl_plotter) (5.15.2)
Requirement already satisfied: scipy in ./.local/lib/python3.6/site-packages (from Python-Alexandria->mpl_plotter) (1.5.4)
Requirement already satisfied: PyYAML>=5.4 in ./.local/lib/python3.6/site-packages (from Python-Alexandria->mpl_plotter) (5.4.1)
Requirement already satisfied: tifffile>=2019.7.26 in ./.local/lib/python3.6/site-packages (from scikit-image->mpl_plotter) (2020.9.3)
Requirement already satisfied: PyWavelets>=1.1.1 in ./.local/lib/python3.6/site-packages (from scikit-image->mpl_plotter) (1.1.1)
Requirement already satisfied: imageio>=2.3.0 in ./.local/lib/python3.6/site-packages (from scikit-image->mpl_plotter) (2.9.0)
Requirement already satisfied: networkx>=2.0 in ./.local/lib/python3.6/site-packages (from scikit-image->mpl_plotter) (2.5.1)
Requirement already satisfied: pillow!=7.1.0,!=7.1.1,>=4.3.0 in /usr/lib/python3/dist-packages (from scikit-image->mpl_plotter) (5.1.0)
Requirement already satisfied: decorator<5,>=4.3 in ./.local/lib/python3.6/site-packages (from networkx>=2.0->scikit-image->mpl_plotter) (4.4.2)

Alright, found.

As you can see in your log, mpl_plotter 3.9.2 is installed in your machine when running pip install mpl_plotter --upgrade.
This is because the minimum Python version required for MPL Plotter was Python 3.7.

I've successfully run all tests on a Python 3.6.9 virtual environment: there being no compatibility issues I've updated the Python version requirement to 3.6, updated the requirements.txt in the repo and published a release to make MPL Plotter compatible with Python >= 3.6.

This release has been tested with Python 3.6.9 and Python 3.6.13, I cannot ensure compatibility with lower versions of Python.

I've then been able to successfully pip install mpl_plotter (version 4.0.5) and run a test on a separate Python 3.6.9 virtual environment. You can see the result in the image attached.

Let me know this solves the issue! :)

image

Closing this as the issue seems to have been dealt with.