Skip to content

pybuilder fails on osx m1  #774

Closed
Closed

Description

@rspitler

I am seeing this failure if I run without --no-venvs

pyb -X
[DEBUG] Registered Python environment 'system': CPython version 3.8.2.final.0 on darwin in ['/Users/***/Code/buddy/venv/bin/python']
PyBuilder version 0.12.10
Build started at 2021-06-07 14:49:57
------------------------------------------------------------
[DEBUG] Loading project module from ./build.py
[DEBUG] Setting up plugins VEnv at '/Users/***/Code/nudge-master/nudge-web-master/code/nudge-frontend/nudge-frontend-default-api/.pybuilder/plugins/cpython-3.8.2.final.0'
ERROR: The executable /Users/***/Code/nudge-master/nudge-web-master/code/nudge-frontend/nudge-frontend-default-api/.pybuilder/plugins/cpython-3.8.2.final.0/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/***/Code/nudge-master/nudge-web-master/code/nudge-frontend/nudge-frontend-default-api' (should be '/Users/***/Code/nudge-master/nudge-web-master/code/nudge-frontend/nudge-frontend-default-api/.pybuilder/plugins/cpython-3.8.2.final.0')
ERROR: virtualenv is not compatible with this system or executable
Traceback (most recent call last):
  File "/Users/***/Code/buddy/venv/lib/python3.8/site-packages/pybuilder/cli.py", line 461, in main
    reactor.prepare_build(property_overrides=options.property_overrides,
  File "/Users/***/Code/buddy/venv/lib/python3.8/site-packages/pybuilder/reactor.py", line 203, in prepare_build
    self._setup_plugin_directory(reset_plugins, no_venvs)
  File "/Users/***/Code/buddy/venv/lib/python3.8/site-packages/pybuilder/reactor.py", line 517, in _setup_plugin_directory
    plugin_env = per["pybuilder"] = PythonEnv(plugin_dir, self).create_venv(with_pip=True,
  File "/Users/***/Code/buddy/venv/lib/python3.8/site-packages/pybuilder/python_env.py", line 209, in create_venv
    create_venv(self._env_dir,
  File "/Users/***/Code/buddy/venv/lib/python3.8/site-packages/pybuilder/python_env.py", line 439, in create_venv
    virtualenv.create_environment(
  File "/Users/***/Code/buddy/venv/lib/python3.8/site-packages/pybuilder/_vendor/virtualenv.py", line 1161, in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
  File "/Users/***/Code/buddy/venv/lib/python3.8/site-packages/pybuilder/_vendor/virtualenv.py", line 1711, in install_python
    sys.exit(100)
SystemExit: 100
------------------------------------------------------------
BUILD FAILED - SystemExit: 100 (pybuilder/_vendor/virtualenv.py:1711)
------------------------------------------------------------
Build finished at 2021-06-07 14:49:57
Build took 0 seconds (421 ms)

Activity

  1. rspitler commented on Jun 7, 2021

    @rspitler
    Author

    If I monkey patch python_env.py:426 to the following and set the flag it works. This seems to follow best practices on python 3+ to use venv over virtualenv but I am also just pawing at this so not familiar with any subtly to that discussion

    ` if os.environ.get("use_venv",False):
    from venv import EnvBuilder

        env = EnvBuilder(system_site_packages=system_site_packages,
                         upgrade=upgrade and (not offline),
                         with_pip=with_pip,
                         prompt=prompt,
                         symlinks=symlinks)
        env.create(home_dir)
    else:
        import virtualenv
    
        with virtualenv.virtualenv_support_dirs() as search_dirs:
            virtualenv.create_environment(
                home_dir,
                site_packages=system_site_packages,
                prompt=prompt,
                search_dirs=search_dirs,
                download=upgrade and (not offline),
                no_setuptools=False,
                no_pip=not with_pip,
                no_wheel=False,
                symlink=symlinks
            )`
    
  2. arcivanov commented on Jun 7, 2021

    @arcivanov
    Member

    Hi, thanks for the report. Are you using stock Python or a Homebrew one?

  3. rspitler commented on Jun 8, 2021

    @rspitler
    Author

    I am running pybuilder out of a virtual env (created through IntelliJ / PyCharm ) off of ../../Library/Frameworks/Python3.framework/Versions/3.8/bin/python3

  4. arcivanov commented on Jun 8, 2021

    @arcivanov
    Member

    Interesting. I had the reverse reported - stock python working and homebrew not working on OSX. Bizarre.

  5. arcivanov commented on Jun 9, 2021

    @arcivanov
    Member

    But this is the same problem I'm observing on Windows as well, which I'm still trying to fix.

  6. rspitler commented on Jun 9, 2021

    @rspitler
    Author

    Not sure if you are interested in the venv route but it cleared up the issue for me - there are a couple of options (setup tools etc) that would take a bit more effort than my trivial example but not too much ... I'll create a pull request it'll just take me a bit to figure out how to pipe it through the CLI properly

  7. arcivanov commented on Jun 10, 2021

    @arcivanov
    Member

    I've had the venv route, but because I have to support all the platforms there was an issue with venv route as well, hence there was a back migration to VirtualEnv.

  8. arcivanov commented on Sep 5, 2021

    @arcivanov
    Member

    Could you please try the latest --pre version of PyBuilder and see if it solved your problem?

  9. arcivanov commented on Sep 7, 2021

    @arcivanov
    Member

    @rspitler ping?

  10. rspitler commented on Sep 8, 2021

    @rspitler
    Author
  11. rspitler commented on Sep 8, 2021

    @rspitler
    Author

    Sorry something else is going on now - see below

    % pyb
    
    PyBuilder version 0.13.0.dev20210908053645
    Build started at 2021-09-08 15:34:49
    ------------------------------------------------------------
    ------------------------------------------------------------
    BUILD FAILED - StopIteration:  (virtualenv/run/plugin/discovery.py:22)
    ------------------------------------------------------------
    Build finished at 2021-09-08 15:34:49
    Build took 0 seconds (54 ms)
    
    % which python3    
    
    /opt/homebrew/bin/python3
  12. arcivanov commented on Sep 8, 2021

    @arcivanov
    Member

    Ah, looks like you're in the same place right now as #771

  13. arcivanov commented on Sep 8, 2021

    @arcivanov
    Member

    In fact it's probably the same exact issue but I'll hold off declaring it so until I gather more evidence.

  14. arcivanov commented on Sep 12, 2021

    @arcivanov
    Member

    I can't seem to reproduce this issue with BigSur and Homebrew on GitHub Actions. Could you please see these logs and tell me whether anything jumps at you as different from your system configuration?

    https://github.com/pybuilder/pybuilder/commit/618512b0f356e3314b1218ae7c0192b9fea49c6b/checks/3581148359/logs

  15. rspitler commented on Sep 13, 2021

    @rspitler
    Author

    The only major delta is that I was running python 3.9.

  16. arcivanov commented on Sep 13, 2021

    @arcivanov
    Member

    The only major delta is that I was running python 3.9.

    Your original filing says 3.8.2:

    pyb -X
    [DEBUG] Registered Python environment 'system': CPython version 3.8.2.final.0 on darwin in ['/Users/***/Code/buddy/venv/bin/python']
    PyBuilder version 0.12.10
    
  17. arcivanov commented on Sep 13, 2021

    @arcivanov
    Member

    @rspitler Have you by any chance installed PyB into --user? Or into the venv in question?

  18. arcivanov commented on Sep 17, 2021

    @arcivanov
    Member

    @rspitler Please test with the latest --pre and let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions