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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't install rpy2 3.5.16 on Ubuntu 22.04.3 LTS #1106

Open
sanboton opened this issue Apr 20, 2024 · 16 comments
Open

can't install rpy2 3.5.16 on Ubuntu 22.04.3 LTS #1106

sanboton opened this issue Apr 20, 2024 · 16 comments
Labels
bug Something isn't working

Comments

@sanboton
Copy link

Describe the issue or bug

I can't install rpy2 3.5.16 on Ubuntu 22.04.3 LTS

To Reproduce

Open cmd as administrator

pip3 install rpy2 or pip install rpy2

Expected behavior
install rpy2

Error

pip3 install rpy2
Defaulting to user installation because normal site-packages is not writeable
Collecting rpy2
  Using cached rpy2-3.5.16.tar.gz (220 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 23, in <module>
          import setuptools.command.build
      ModuleNotFoundError: No module named 'setuptools.command.build'
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
@sanboton sanboton added the bug Something isn't working label Apr 20, 2024
@sanboton
Copy link
Author

I had to go down to version 3.5.2 to be able to install it

@lgautier
Copy link
Member

What is your version of setuptools?

@sanboton
Copy link
Author

Hi, it's 69.5.1.

pip3 show setuptools
Name: setuptools
Version: 69.5.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License:
Location: /home/NAME/.local/lib/python3.10/site-packages
Requires:
Required-by: APScheduler

@lgautier
Copy link
Member

I can't reproduce with Ubuntu 22.04, Python 3.10, and the same setuptools. It installs fine. What is your Python version?

@sanboton
Copy link
Author

My version is 3.10.12:

python3 -V
Python 3.10.12

@lgautier
Copy link
Member

The error traceback says that the path is /usr/lib/python3/dist-packages/setuptools/build_meta.py while pip3 show setuptools says that the path is /home/NAME/.local/lib/python3.10/site-packages.

@Hasnae12
Copy link

Hasnae12 commented May 1, 2024

Describe the issue or bug

I can't install rpy2 3.5.16 on Ubuntu 22.04.3 LTS

To Reproduce

Open cmd as administrator

pip3 install rpy2 or pip install rpy2

Expected behavior install rpy2

Error

pip3 install rpy2
Defaulting to user installation because normal site-packages is not writeable
Collecting rpy2
  Using cached rpy2-3.5.16.tar.gz (220 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 23, in <module>
          import setuptools.command.build
      ModuleNotFoundError: No module named 'setuptools.command.build'
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

Hi, I have the same issue on Ubuntu 20.04.6 LTS

@lgautier
Copy link
Member

lgautier commented May 5, 2024

The last mentions

Open cmd as administrator

while the traceback has

Defaulting to user installation because normal site-packages is not writeable

There is a contradiction.

I believe that both error reports result from invalid assumptions by the operators about what Python+libraries are used, or the system ID running the installation process.

@D3SL
Copy link

D3SL commented May 11, 2024

Had this as well. Using rocker/r2u:jammy as a base I couldn't get the latest version of rpy2 to install, only 3.5.2.

Edit: I solved this with RUN pip3 install --upgrade pip wheel setuptools>51 prior to trying to install rpy2.

@Yunuuuu
Copy link

Yunuuuu commented May 16, 2024

The same problem

@Yunuuuu
Copy link

Yunuuuu commented May 16, 2024

Had this as well. Using rocker/r2u:jammy as a base I couldn't get the latest version of rpy2 to install, only 3.5.2.

Edit: I solved this with RUN pip3 install --upgrade pip wheel setuptools>51 prior to trying to install rpy2.

This works well

@amano-takahisa
Copy link

amano-takahisa commented May 17, 2024

Same issues on Ubuntu 24.04.

To reproduce, build container with following Dockerfile:

FROM ubuntu:24.04

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    r-base \
    r-base-dev \
    python3 \
    python3-pip \
    python3-venv

USER ubuntu
WORKDIR /home/ubuntu

Build and enter the container with docker build -t test_rpy2 . && docker run -it --rm test_rpy2 /bin/bash, and in that container, run:

python3 -m venv .venv
source .venv/bin/activate
pip install -U pip setuptools 
pip install rpy2

Raise the following error.

Details
$ pip install rpy2
Collecting rpy2
  Downloading rpy2-3.5.16.tar.gz (220 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 220.0/220.0 kB 8.1 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [37 lines of output]
/usr/bin/ld: cannot find -ltirpc: No such file or directory
collect2: error: ld returned 1 exit status
Traceback (most recent call last):
File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/_distutils/unixccompiler.py", line 269, in link
self.spawn(linker + ld_args)
File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn
spawn(cmd, dry_run=self.dry_run, **kwargs)
File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/_distutils/spawn.py", line 68, in spawn
raise DistutilsExecError(f"command {cmd!r} failed with exit code {exitcode}")
distutils.errors.DistutilsExecError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/ubuntu/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/ubuntu/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/ubuntu/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 141, in <module>
    File "<string>", line 121, in get_r_c_extension_status
    File "<string>", line 82, in get_c_extension_status
    File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/_distutils/ccompiler.py", line 781, in link_executable
      self.link(
    File "/tmp/pip-build-env-3em6ull7/overlay/lib/python3.12/site-packages/setuptools/_distutils/unixccompiler.py", line 271, in link
      raise LinkError(msg)
  distutils.errors.LinkError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

pip install 'rpy2<=3.5.12' worked, but not pip install 'rpy2>=3.5.13'.

setuptools is as follows:

$ pip3 show setuptools
Name: setuptools
Version: 69.5.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License:
Location: /home/ubuntu/.venv/lib/python3.12/site-packages
Requires:
Required-by:

@amano-takahisa
Copy link

amano-takahisa commented May 18, 2024

I solved my issue with apt-get install libtirpc-dev beforehand.

@lgautier
Copy link
Member

Had this as well. Using rocker/r2u:jammy as a base I couldn't get the latest version of rpy2 to install, only 3.5.2.

Edit: I solved this with RUN pip3 install --upgrade pip wheel setuptools>51 prior to trying to install rpy2.

@D3SL - This seems odd. rpy2 already requires setuptools>=61:

"setuptools >= 61",

@lgautier
Copy link
Member

I solved my issue with apt-get install libtirpc-dev beforehand.

@amano-takahisa - The library is a dependency for R builds (see https://archlinux.org/packages/extra/x86_64/r/) but I was not aware that the headers were also necessary (when build C extensions for rpy2). Did you identify where those headers are required?

@amano-takahisa
Copy link

@lgautier I'm not sure where that the header is required.
I just guessed from the following part of error message.

/usr/bin/ld: cannot find -ltirpc: No such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants