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

Cannot "pip install maturin" on openbsd 6.8 #481

Closed
toyg opened this issue Mar 31, 2021 · 7 comments · Fixed by #697
Closed

Cannot "pip install maturin" on openbsd 6.8 #481

toyg opened this issue Mar 31, 2021 · 7 comments · Fixed by #697

Comments

@toyg
Copy link

toyg commented Mar 31, 2021

Please provide the following information:

  • Your python version (python -V):
    tested with 3.8.6 (system) and 3.9.2 (built by pyenv)
  • Your pip version (pip -V):
    21.0.1
  • Does cargo build work?
    cargo install maturin works fine

Please list the exact steps required to reproduce your error with all command output and if possible with a repository:

  • install OpenBSD 6.8 (I used the Vagrant image generic/openbsd6 )
  • install the minimal required packages python3 py3-pip libffi sqlite3 (with doas pkg_add ... or sudo pkg_add ...)
  • create virtualenv: python3 -m venv venv && source ./venv/bin/activate && pip install --upgrade pip
  • pip install maturin

The output is available here: https://pastebin.com/MhPm0ktH

It looks like all dependencies get compiled correctly, but then it fails to compile maturin. However, a generic cargo install maturin on the same machine works fine, so the issue must be a difference between the way it's compiled there and in the wheel. I tried using virtualenvs for 3.9 and 3.8 as described above, and on system too (sudo pip3.8 install maturin )

I can't seem to find a way to save the actual compilation log (pip deletes the temporary directory on failure), if you know it just let me know and I'll produce the tmp files.

For the record, I am not going to use maturin directly; it's a dependency of something else that I need, so I may not be familiar with all the gotchas of maturin.

@messense
Copy link
Member

messense commented Apr 6, 2021

Try pip install -vv maturin to get a verbose error output.

@toyg
Copy link
Author

toyg commented Apr 6, 2021

Compiling maturin v0.10.0 (/tmp/pip-install-z5xe1g4r/maturin)
      Finished dev [unoptimized + debuginfo] target(s) in 7m 02s
  {'reason': 'compiler-artifact', 'package_id': 'maturin 0.10.0 (path+file:///tmp/pip-install-z5xe1g4r/maturin)', 'target': {'kind': ['bin'], 'crate_types': ['bin'], 'name': 'maturin', 'src_path': '/tmp/pip-install-z5xe1g4r/maturin/src/main.rs', 'edition': '2018', 'doctest': False}, 'profile': {'opt_level': '0', 'debuginfo': 2, 'debug_assertions': True, 'overflow_checks': True, 'test': False}, 'features': ['configparser', 'default', 'dirs', 'human-panic', 'log', 'pretty_env_logger', 'reqwest', 'rpassword', 'rustls', 'upload'], 'filenames': [], 'executable': '/tmp/pip-install-z5xe1g4r/maturin/target/debug/maturin', 'fresh': False}
  Traceback (most recent call last):
    File "/home/vagrant/maturin_test/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/home/vagrant/maturin_test/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/vagrant/maturin_test/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-en4frrsw/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 216, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-en4frrsw/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-en4frrsw/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 96, in <module>
      setup(
    File "/tmp/pip-build-env-en4frrsw/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-en4frrsw/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 335, in run
      self.run_command('install')
    File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "setup.py", line 75, in run
      source = metadata["filenames"][0]
  IndexError: list index out of range
Building wheel for maturin (PEP 517) ... error
ERROR: Failed building wheel for maturin
Failed to build maturin
ERROR: Could not build wheels for maturin which use PEP 517 and cannot be installed directly
Exception information:
Traceback (most recent call last):
  File "/home/vagrant/maturin_test/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
    status = self.run(options, args)
  File "/home/vagrant/maturin_test/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "/home/vagrant/maturin_test/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 365, in run
    raise InstallationError(
pip._internal.exceptions.InstallationError: Could not build wheels for maturin which use PEP 517 and cannot be installed directly

@messense
Copy link
Member

messense commented Apr 6, 2021

{'reason': 'compiler-artifact', 'package_id': 'maturin 0.10.0 (path+file:///tmp/pip-install-z5xe1g4r/maturin)', 'target': {'kind': ['bin'], 'crate_types': ['bin'], 'name': 'maturin', 'src_path': '/tmp/pip-install-z5xe1g4r/maturin/src/main.rs', 'edition': '2018', 'doctest': False}, 'profile': {'opt_level': '0', 'debuginfo': 2, 'debug_assertions': True, 'overflow_checks': True, 'test': False}, 'features': ['configparser', 'default', 'dirs', 'human-panic', 'log', 'pretty_env_logger', 'reqwest', 'rpassword', 'rustls', 'upload'], 'filenames': [], 'executable': '/tmp/pip-install-z5xe1g4r/maturin/target/debug/maturin', 'fresh': False}

Looks like filenames is empty, I'm not sure why.

@messense
Copy link
Member

messense commented Apr 25, 2021

I was trying to reproduce the error on OpenBSD 6.8 but get a different type of error, the linker segfaults when doing the final linking, removing link-arg=-s made it work.

Looks like the same issue with #505

@konstin How about using strip command instead of link-arg=-s?

@messense
Copy link
Member

{'reason': 'compiler-artifact', 'package_id': 'maturin 0.10.0 (path+file:///tmp/pip-install-z5xe1g4r/maturin)', 'target': {'kind': ['bin'], 'crate_types': ['bin'], 'name': 'maturin', 'src_path': '/tmp/pip-install-z5xe1g4r/maturin/src/main.rs', 'edition': '2018', 'doctest': False}, 'profile': {'opt_level': '0', 'debuginfo': 2, 'debug_assertions': True, 'overflow_checks': True, 'test': False}, 'features': ['configparser', 'default', 'dirs', 'human-panic', 'log', 'pretty_env_logger', 'reqwest', 'rpassword', 'rustls', 'upload'], 'filenames': [], 'executable': '/tmp/pip-install-z5xe1g4r/maturin/target/debug/maturin', 'fresh': False}

Looks like filenames is empty, I'm not sure why.

@konstin Do you think it's possible to the executable field instead of filenames in this case?

@messense
Copy link
Member

@konstin I think we can drop link-args=-s after 012df9c , the binary size dropped down to only 17.8M on my OpenBSD VM without link-args=-s.

@messense
Copy link
Member

{'reason': 'compiler-artifact', 'package_id': 'maturin 0.10.0 (path+file:///tmp/pip-install-z5xe1g4r/maturin)', 'target': {'kind': ['bin'], 'crate_types': ['bin'], 'name': 'maturin', 'src_path': '/tmp/pip-install-z5xe1g4r/maturin/src/main.rs', 'edition': '2018', 'doctest': False}, 'profile': {'opt_level': '0', 'debuginfo': 2, 'debug_assertions': True, 'overflow_checks': True, 'test': False}, 'features': ['configparser', 'default', 'dirs', 'human-panic', 'log', 'pretty_env_logger', 'reqwest', 'rpassword', 'rustls', 'upload'], 'filenames': [], 'executable': '/tmp/pip-install-z5xe1g4r/maturin/target/debug/maturin', 'fresh': False}

Looks like filenames is empty, I'm not sure why.

@konstin Do you think it's possible to the executable field instead of filenames in this case?

I think it's doable according to https://docs.rs/cargo_metadata/0.13.1/cargo_metadata/struct.Artifact.html#structfield.executable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants