1

I recently upgraded my system from an Intel Mac to an M1 Pro. I need to use p4python module.

I installed Python 3.7.13 using pyenv which I installed using Homebrew. All Apple Silicon native. When I try to pip install p4python I get:

% python -m pip install p4python
Looking in indexes: https://pypi.org/simple, https://pypi.ni.systems
Collecting p4python
  Using cached https://pypi.ni.systems/packages/packages/ca/e7/ea1e0416730f9184349f7d26a043e873e218a8542afa648dc8c935450a1a/p4python-2022.1.2299330.tar.gz (82 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for p4python, since package 'wheel' is not installed.
Installing collected packages: p4python
  Running setup.py install for p4python ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for p4python did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.macosx-12.4-arm64-3.7
      copying P4.py -> build/lib.macosx-12.4-arm64-3.7
      running build_ext
      ***********************************************
      ** Cannot build P4Python without SSL support **
      ***********************************************
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/91/5p070nb15ks8yk3v46qh19v40000gn/T/pip-install-4digz9ul/p4python_110e66d84cfe40b99ca0929ab19e1968/setup.py", line 475, in <module>
          do_setup()
        File "/private/var/folders/91/5p070nb15ks8yk3v46qh19v40000gn/T/pip-install-4digz9ul/p4python_110e66d84cfe40b99ca0929ab19e1968/setup.py", line 442, in do_setup
          'sdist': p4build_sdist,
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
          return distutils.core.setup(**attrs)
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
          return orig.install.run(self)
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/command/install.py", line 545, in run
          self.run_command('build')
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Users/kirsch/.pyenv/versions/3.7.13/lib/python3.7/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/91/5p070nb15ks8yk3v46qh19v40000gn/T/pip-install-4digz9ul/p4python_110e66d84cfe40b99ca0929ab19e1968/setup.py", line 292, in run
          raise Exception("Parameter --ssl is needed")
      Exception: Parameter --ssl is needed
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> p4python

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Has anyone gotten this to work?

2 Answers 2

3

At this time (July 2022), Perforce is not available natively for Apple Silicon (M1) hardware, based on their download page.

Since p4python loads and calls into libraries, both the process that does the loading (Python) and the library that is getting loaded need to be built for the same architecture. That means you cannot use Python for M1 with p4python.

The unfortunate fallback is to install the x64 version of Python and go from there.

0

Yes p4python installs for me on an M1 Max machine using a whl file - I have not tried from a source distribution, as it looks like you are trying:

(base) Charlie:~ sfederman$ pip install p4python
Collecting p4python
  Downloading p4python-2022.1.2299330-cp39-cp39-macosx_10_12_universal2.whl (2.8 MB)
     |████████████████████████████████| 2.8 MB 3.4 MB/s
Installing collected packages: p4python
Successfully installed p4python-2022.1.2299330
(base) Charlie:~ sfederman$ which pip
/Users/sfederman/opt/anaconda3/bin/pip
(base) Charlie:~ sfederman$ python --version
Python 3.9.7

Since you are installing on Python 3.7.13, perhaps try the whl file for that Python version from here?

5
  • I tried installing p4python using Python 3.9 (3.9.13 in my case) and it does work. But if you try to import P4 it dies with ImportError at dlopen because P4API.cpython-39-darwin.so is for x86_64. Does it work for you?
    – kirsch
    Jul 21, 2022 at 15:31
  • The import does work successfully import P4 - I haven't gone further with using the library.
    – Scot
    Jul 21, 2022 at 17:01
  • Weird. Can you confirm your Python binary is native for Apple Silicon and not running under Rosetta? Perforce's download page doesn't even show an Apple Silicon build!
    – kirsch
    Jul 21, 2022 at 18:30
  • This version of python is in a conda environment, and -is- running under Rosetta. (it is Mach-O 64-bit executable x86_64 only). A similar setup may work for you?
    – Scot
    Jul 21, 2022 at 18:50
  • Yeah, I can fallback to Intel build of everything. It's just an unfortunate loss of performance.
    – kirsch
    Jul 21, 2022 at 21:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .