KrishnaswamyLab / phateR

PHATE dimensionality reduction method implemented in R
GNU General Public License v2.0
77 stars 9 forks source link

Failed to install phate in python 3.10 / Ubuntu 22.04 #63

Closed GMFranceschini closed 2 years ago

GMFranceschini commented 2 years ago

Describe the bug I am trying to install phate in python and I get an error.

To Reproduce pip install --user phate

Expected behavior Installation completes successfully

Actual behavior The error is attached below.

System information: Python 3.10.4 , Ubuntu 22.04


Output of `pd.show_versions()`:

commit           : 4bfe3d07b4858144c219b9346329027024102ab6
python           : 3.10.4.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.15.0-40-generic
Version          : #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 1.4.2
numpy            : 1.21.6
pytz             : 2022.1
dateutil         : 2.8.2
pip              : 22.1.2
setuptools       : 59.5.0
Cython           : 0.29.28
pytest           : 7.1.2
hypothesis       : None
sphinx           : None
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : 4.9.0
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : None
IPython          : None
pandas_datareader: None
bs4              : 4.11.1
bottleneck       : None
brotli           : None
fastparquet      : None
fsspec           : 2022.3.0
gcsfs            : None
markupsafe       : None
matplotlib       : None
numba            : 0.55.1
numexpr          : None
odfpy            : None
openpyxl         : 3.0.9
pandas_gbq       : None
pyarrow          : None
pyreadstat       : None
pyxlsb           : None
s3fs             : None
scipy            : 1.8.0
snappy           : None
sqlalchemy       : None
tables           : None
tabulate         : 0.8.9
xarray           : 2022.3.0
xlrd             : None
xlwt             : None
zstandard        : None
error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [74 lines of output]
      /home/gianma/.pyenv/versions/3.10.4/lib/python3.10/distutils/extension.py:132: UserWarning: Unknown Extension options: 'headers'
        warnings.warn(msg)
      /home/gianma/.local/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      WARNING: The wheel package is not available.
        error: subprocess-exited-with-error

        × python setup.py bdist_wheel did not run successfully.
        │ exit code: 1
        ╰─> [9 lines of output]
            Running from numpy source directory.
            /tmp/pip-wheel-p5ae4yde/numpy_5e71e7bc67234eeb870db274ea202e7b/numpy/distutils/misc_util.py:476: SyntaxWarning: "is" with a literal. Did you mean "=="?
              return is_string(s) and ('*' in s or '?' is s)
            usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
               or: setup.py --help [cmd1 cmd2 ...]
               or: setup.py --help-commands
               or: setup.py cmd --help

            error: invalid command 'bdist_wheel'
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for numpy
        error: subprocess-exited-with-error

        × python setup.py clean did not run successfully.
        │ exit code: 1
        ╰─> [10 lines of output]
            Running from numpy source directory.

            `setup.py clean` is not supported, use one of the following instead:

              - `git clean -xdf` (cleans all files)
              - `git clean -Xdf` (cleans all versioned files, doesn't touch
                                  files that aren't checked into the git repo)

            Add `--force` to your command to use it anyway if you must (unsupported).

            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed cleaning build dir for numpy
      ERROR: Failed to build one or more wheels
      Traceback (most recent call last):
        File "/home/gianma/.local/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
          subprocess.check_call(cmd)
        File "/home/gianma/.pyenv/versions/3.10.4/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/home/gianma/.pyenv/versions/3.10.4/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpfo5u5bvy', '--quiet', 'numpy<1.17,>=1.16']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-vocqy9nv/s-gd2_6581b9c607274cf3914d949581dd8eb3/setup.py", line 50, in <module>
          setup(
        File "/home/gianma/.local/lib/python3.10/site-packages/setuptools/__init__.py", line 152, in setup
          _install_setup_requires(attrs)
        File "/home/gianma/.local/lib/python3.10/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)
        File "/home/gianma/.local/lib/python3.10/site-packages/setuptools/dist.py", line 809, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/home/gianma/.local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 771, in resolve
          dist = best[req.key] = env.best_match(
        File "/home/gianma/.local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1056, in best_match
          return self.obtain(req, installer)
        File "/home/gianma/.local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1068, in obtain
          return installer(requirement)
        File "/home/gianma/.local/lib/python3.10/site-packages/setuptools/dist.py", line 880, in fetch_build_egg
          return fetch_build_egg(self, req)
        File "/home/gianma/.local/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/home/gianma/.pyenv/versions/3.10.4/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpfo5u5bvy', '--quiet', 'numpy<1.17,>=1.16']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
scottgigante commented 2 years ago

Can you try running

pip install "numpy<1.17,>=1.16"

? Looks like this might be a problem with numpy, not with phate.

GMFranceschini commented 2 years ago

Thank you Scott, I wasn't able to go back to a previous numpy version, but installing with reticulate::py_install("phate", pip=TRUE) worked. Oddly, it seems that the numpy version is non the one that you required, so I guess it could be the fact that I was using 3.10 and here miniconda uses 3.8. I close the issue as I am now able to run phate!

reticulate::py_config()
python:         /home/gianma/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython:      /home/gianma/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.8.so
pythonhome:     /home/gianma/.local/share/r-miniconda/envs/r-reticulate:/home/gianma/.local/share/r-miniconda/envs/r-reticulate
version:        3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:18)  [GCC 10.3.0]
numpy:          /home/gianma/.local/share/r-miniconda/envs/r-reticulate/lib/python3.8/site-packages/numpy
numpy_version:  1.23.1
scottgigante commented 2 years ago

Hmm, odd. I just looked at PHATE's requirements and we don't restrict numpy<1.17 so I'm not quite sure where that came from, but in any case I'm glad you got it installed!