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

pybuilder fails on osx m1 #774

Closed
rspitler opened this issue Jun 7, 2021 · 18 comments
Closed

pybuilder fails on osx m1 #774

rspitler opened this issue Jun 7, 2021 · 18 comments
Labels

Comments

@rspitler
Copy link

rspitler commented Jun 7, 2021

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)
@rspitler
Copy link
Author

rspitler commented Jun 7, 2021

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
        )`

@arcivanov
Copy link
Member

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

@rspitler
Copy link
Author

rspitler commented Jun 8, 2021

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

@arcivanov
Copy link
Member

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

@arcivanov
Copy link
Member

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

@rspitler
Copy link
Author

rspitler commented Jun 9, 2021

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

@arcivanov
Copy link
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.

@arcivanov
Copy link
Member

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

@arcivanov
Copy link
Member

@rspitler ping?

@rspitler
Copy link
Author

rspitler commented Sep 8, 2021 via email

@rspitler
Copy link
Author

rspitler commented Sep 8, 2021

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

@arcivanov
Copy link
Member

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

@arcivanov
Copy link
Member

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

@arcivanov
Copy link
Member

arcivanov commented Sep 12, 2021

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

@rspitler
Copy link
Author

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

@arcivanov
Copy link
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

@arcivanov
Copy link
Member

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

@arcivanov
Copy link
Member

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

arcivanov added a commit to arcivanov/pybuilder that referenced this issue Sep 26, 2021
Vendorize latest virtualenv with cleanup fixes

fixes pybuilder#795, pybuilder#777, pybuilder#774, pybuilder#771
arcivanov added a commit to arcivanov/pybuilder that referenced this issue Sep 26, 2021
Vendorize latest virtualenv with cleanup fixes
Bump version to 0.13.0

fixes pybuilder#795, pybuilder#777, pybuilder#774, pybuilder#771
arcivanov added a commit to arcivanov/pybuilder that referenced this issue Sep 26, 2021
Vendorize latest virtualenv with cleanup fixes
Bump version to 0.13.0

fixes pybuilder#795, pybuilder#777, pybuilder#774, pybuilder#771
arcivanov added a commit to arcivanov/pybuilder that referenced this issue Sep 26, 2021
Vendorize latest virtualenv with cleanup fixes
Bump version to 0.13.0

fixes pybuilder#795, pybuilder#777, pybuilder#774, pybuilder#771
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants