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

Install failed on M1 Mac #159

Closed
MasatoshiTada opened this issue Jan 8, 2021 · 5 comments · Fixed by #167
Closed

Install failed on M1 Mac #159

MasatoshiTada opened this issue Jan 8, 2021 · 5 comments · Fixed by #167

Comments

@MasatoshiTada
Copy link

Abstraction

I tried pip install jsonschema-rs on M1 Mac, but failed to install.

On Intel Mac, I succeeded to install it (even without Rust!).

Environment

  • OS: macOS Big Sur 11.1
  • Hardware: MacBook Pro 13, M1, 2020
  • rustc: 1.49.0 ( brew install rust )
  • cargo: 1.48.0 ( brew install rust )
  • xcode-select: 2384

Log

$ pip install jsonschema-rs                    
Collecting jsonschema-rs
  Using cached jsonschema_rs-0.4.3.tar.gz (8.7 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: jsonschema-rs
  Building wheel for jsonschema-rs (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/tada/IdeaProjects/flask-python-web/sources/edu-flask-ch07-validation-sample/venv/bin/python /Users/tada/IdeaProjects/flask-python-web/sources/edu-flask-ch07-validation-sample/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/tmpg00vk284
       cwd: /private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-install-vdj_jrmw/jsonschema-rs_97cae515d4ea44d3a958b86966c55c66
  Complete output (67 lines):
  running bdist_wheel
  running build
  running build_ext
  running build_rust
  error: failed to get `jsonschema` as a dependency of package `jsonschema-python v0.1.0 (/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-install-vdj_jrmw/jsonschema-rs_97cae515d4ea44d3a958b86966c55c66)`
  
  Caused by:
    failed to load source for dependency `jsonschema`
  
  Caused by:
    Unable to update /private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-install-vdj_jrmw
  
  Caused by:
    failed to read `/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-install-vdj_jrmw/Cargo.toml`
  
  Caused by:
    No such file or directory (os error 2)
  Traceback (most recent call last):
    File "/Users/tada/IdeaProjects/flask-python-web/sources/edu-flask-ch07-validation-sample/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/Users/tada/IdeaProjects/flask-python-web/sources/edu-flask-ch07-validation-sample/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/tada/IdeaProjects/flask-python-web/sources/edu-flask-ch07-validation-sample/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 216, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
      self.run_setup()
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 54, in <module>
      call_setup()
    File "setup.py", line 21, in call_setup
      setup(
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools_rust/setuptools_ext.py", line 23, in run
      build_rust.run()
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools_rust/build.py", line 357, in run
      self.build_extension(ext)
    File "/private/var/folders/nx/h8wf5bwx4ybb3hcj_d6bmrr00000gn/T/pip-build-env-o9gkrvqe/overlay/lib/python3.9/site-packages/setuptools_rust/build.py", line 120, in build_extension
      metadata = json.loads(check_output(metadata_command).decode("utf-8"))
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 420, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "/opt/homebrew/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 524, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['cargo', 'metadata', '--manifest-path', 'Cargo.toml', '--format-version', '1']' returned non-zero exit status 101.
  ----------------------------------------
  ERROR: Failed building wheel for jsonschema-rs
Failed to build jsonschema-rs
ERROR: Could not build wheels for jsonschema-rs which use PEP 517 and cannot be installed directly
@Stranger6667
Copy link
Owner

Stranger6667 commented Jan 14, 2021

Hi @MasatoshiTada !

Sorry for the late reply. I will take a look at this in the next few days. At the first glance - I forgot to properly adjust the sdist package. Before, it was copying the dependency inside and adjusting Cargo.toml so the Rust compiler can find it during installation.

@Stranger6667
Copy link
Owner

Stranger6667 commented Jan 14, 2021

These are mostly notes for myself:

In the perfect case, I'd also like to build wheels to avoid manual compilation on the user side, but GH Actions do not yet support M1. I do not have access to one myself, and other CI solutions don't seem like providing it as well.

Ref: actions/runner-images#2187

Alternatively, I can use aarch64-apple-darwin target during compilation. Need to check

@Stranger6667
Copy link
Owner

The problem with missing files is fixed (not released yet, though). The tracking issue for building wheels for M1 is #165. I plan to add it and release a new version with both - working sdist and a wheel for M1.

@Stranger6667
Copy link
Owner

A quick update - I released the sdist fix in 0.5.0 (and shrunk the sdist size in 0.5.1). It should be possible to install this package on M1 if there is a recent rust toolchain installed. There is a test for it in our CI - it installs the sdist package on a Linux environment, but it should work the same on M1. Let me know if it doesn't work.

Building wheels will take some more time, unfortunately. I am sorry about that.

@juyoungkimthedev
Copy link

I still can't install on M1 Mac still getting failed to build wheel for jsonschema-rs

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.

3 participants