PHATE in R cannot detect matplotlib python dependency but numpy is fine
0
0
Entering edit mode
24 months ago

I was able to install numpy and all other python dependencies except matplotlib. Please let me know what is going on.

reticulate::py_install("matplotlib") Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... done

All requested packages already installed. reticulate::py_config() python: /opt/anaconda3/bin/python libpython: /opt/anaconda3/lib/libpython3.7m.dylib pythonhome: /opt/anaconda3:/opt/anaconda3 version: 3.7.6 (default, Jan 8 2020, 13:42:34) [Clang 4.0.1 (tags/RELEASE_401/final)] numpy: /opt/anaconda3/lib/python3.7/site-packages/numpy numpy_version: 1.21.6 magic: /opt/anaconda3/lib/python3.7/site-packages/magic

NOTE: Python version was forced by use_python function

reticulate::py_discover_config() python: /opt/anaconda3/bin/python libpython: /opt/anaconda3/lib/libpython3.7m.dylib pythonhome: /opt/anaconda3:/opt/anaconda3 version: 3.7.6 (default, Jan 8 2020, 13:42:34) [Clang 4.0.1 (tags/RELEASE_401/final)] numpy: /opt/anaconda3/lib/python3.7/site-packages/numpy numpy_version: 1.21.6

phate.tree <- phate(tree.data.small$data) Error in py_module_import(module, convert = convert) : ModuleNotFoundError: No module named 'matplotlib.pyplot' Error in py_module_import(module, convert = convert) : ModuleNotFoundError: No module named 'matplotlib.pyplot'

PHATE • 1.6k views
ADD COMMENT
0
Entering edit mode

Could you show the output of reticulate::py_discover_config(required_module="phate")?

ADD REPLY
0
Entering edit mode

reticulate::py_discover_config(required_module = "phate") when I run on R

python: /opt/anaconda3/bin/python libpython: /opt/anaconda3/lib/libpython3.7m.dylib pythonhome: /opt/anaconda3:/opt/anaconda3 version: 3.7.6 (default, Jan 8 2020, 13:42:34) [Clang 4.0.1 (tags/RELEASE_401/final)] numpy: /opt/anaconda3/lib/python3.7/site-packages/numpy numpy_version: 1.21.6 phate: /Users/abhaykanodia/.local/lib/python3.7/site-packages/phate-1.0.7-py3.7.egg/phate

NOTE: Python version was forced by use_python function

Output of reticulate::py_discover_config(required_module = "phate"): When I run on Terminal

Error in python_config_impl(python) :

Error 137 occurred running /Users/abhaykanodia/.virtualenvs/r-reticulate/bin/python:

In addition: Warning message:

In system2(command = python, args = shQuote(script), stdout = TRUE, :

running command ''/Users/abhaykanodia/.virtualenvs/r-reticulate/bin/python' '/Library/Frameworks/R.framework/Versions/4.1/Resources/library/reticulate/config/config.py' 2>/dev/null' had status 137

Even though I installed matplotlib when I import phate it says "ModuleNotFoundError: No module named 'matplotlib.pyplot' "

(base) MacBook-Pro:Python abhaykanodia$ python -m pip install matplotlib

Requirement already satisfied: matplotlib in /opt/anaconda3/lib/python3.7/site-packages (3.1.3)

Requirement already satisfied: python-dateutil>=2.1 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib) (2.8.2)

Requirement already satisfied: cycler>=0.10 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib) (0.11.0)

Requirement already satisfied: kiwisolver>=1.0.1 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib) (1.4.2)

Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib) (3.0.8)

Requirement already satisfied: numpy>=1.11 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib) (1.21.6)

Requirement already satisfied: typing-extensions in /opt/anaconda3/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib) (4.2.0)

Requirement already satisfied: six>=1.5 in /opt/anaconda3/lib/python3.7/site-packages (from python-dateutil>=2.1->matplotlib) (1.16.0)

(base) MacBook-Pro:Python abhaykanodia$ Python

Python 3.7.6 (default, Jan 8 2020, 13:42:34)

[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin

Type "help", "copyright", "credits" or "license" for more information.

import phate

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File "/Users/abhaykanodia/PHATE/Python/phate/__init__.py", line 3, in <module>

from .phate import PHATE

File "/Users/abhaykanodia/PHATE/Python/phate/phate.py", line 17, in <module>

import matplotlib.pyplot as plt

ModuleNotFoundError: No module named 'matplotlib.pyplot'

ADD REPLY
0
Entering edit mode

I think the main issue here is that you did not install phate in your python path, because your python version is in an anaconda environment and your phate version is in the user path. You need to homogenize your environments

ADD REPLY
0
Entering edit mode

Thanks a lot for your help!

ADD REPLY
0
Entering edit mode

I was able to resolve the issue but now the issue is with magic now. I would be very grateful if I could resolve this issue.

I ran these commands and the output was as follows:

In R:

reticulate::py_module_available("magic") [1] FALSE reticulate::py_available() [1] TRUE reticulate::import("magic") Error in py_module_import(module, convert = convert) : ModuleNotFoundError: No module named 'magic'

In Terminal

pip3 install magic-impute

Requirement already satisfied: magic-impute in ./opt/anaconda3/lib/python3.9/site-packages (3.0.0)

Requirement already satisfied: scipy>=1.1.0 in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (1.7.1)

Requirement already satisfied: scikit-learn>=0.19.1 in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (0.24.2)

Requirement already satisfied: graphtools>=1.4.0 in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (1.5.2)

Requirement already satisfied: tasklogger>=1.0.0 in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (1.1.2)

Requirement already satisfied: matplotlib in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (3.4.3)

Requirement already satisfied: future in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (0.18.2)

Requirement already satisfied: numpy>=1.14.0 in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (1.20.3)

Requirement already satisfied: pandas>=0.25 in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (1.3.4)

Requirement already satisfied: scprep>=1.0 in ./opt/anaconda3/lib/python3.9/site-packages (from magic-impute) (1.1.0)

Requirement already satisfied: pygsp>=0.5.1 in ./opt/anaconda3/lib/python3.9/site-packages (from graphtools>=1.4.0->magic-impute) (0.5.1)

Requirement already satisfied: Deprecated in ./opt/anaconda3/lib/python3.9/site-packages (from graphtools>=1.4.0->magic-impute) (1.2.13)

Requirement already satisfied: python-dateutil>=2.7.3 in ./opt/anaconda3/lib/python3.9/site-packages (from pandas>=0.25->magic-impute) (2.8.2)

Requirement already satisfied: pytz>=2017.3 in ./opt/anaconda3/lib/python3.9/site-packages (from pandas>=0.25->magic-impute) (2021.3)

Requirement already satisfied: six>=1.5 in ./opt/anaconda3/lib/python3.9/site-packages (from python-dateutil>=2.7.3->pandas>=0.25->magic-impute) (1.16.0)

Requirement already satisfied: joblib>=0.11 in ./opt/anaconda3/lib/python3.9/site-packages (from scikit-learn>=0.19.1->magic-impute) (1.1.0)

Requirement already satisfied: threadpoolctl>=2.0.0 in ./opt/anaconda3/lib/python3.9/site-packages (from scikit-learn>=0.19.1->magic-impute) (2.2.0)

Requirement already satisfied: packaging in ./opt/anaconda3/lib/python3.9/site-packages (from scprep>=1.0->magic-impute) (21.0)

Requirement already satisfied: decorator>=4.3.0 in ./opt/anaconda3/lib/python3.9/site-packages (from scprep>=1.0->magic-impute) (5.1.0)

Requirement already satisfied: wrapt<2,>=1.10 in ./opt/anaconda3/lib/python3.9/site-packages (from Deprecated->graphtools>=1.4.0->magic-impute) (1.12.1)

Requirement already satisfied: kiwisolver>=1.0.1 in ./opt/anaconda3/lib/python3.9/site-packages (from matplotlib->magic-impute) (1.3.1)

Requirement already satisfied: cycler>=0.10 in ./opt/anaconda3/lib/python3.9/site-packages (from matplotlib->magic-impute) (0.10.0)

Requirement already satisfied: pillow>=6.2.0 in ./opt/anaconda3/lib/python3.9/site-packages (from matplotlib->magic-impute) (8.4.0)

Requirement already satisfied: pyparsing>=2.2.1 in ./opt/anaconda3/lib/python3.9/site-packages (from matplotlib->magic-impute) (3.0.4)

Thank you!

ADD REPLY

Login before adding your answer.

Traffic: 1555 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6