indygreg / indygreg/PyOxidizer

Unable to get psutil to work on MacOS (works on windows). Error: resource collector doesn't accept in-memory nor filesystem-relative.

Open
#731 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

With the following options (in Mac OS, M1, Ventura 13.4):

```
for resource in exe.pip_install(
[
"psutil>=5",
]
):
resource.add_location = "in-memory"
resource.add_location_fallback = "filesystem-relative:lib"
exe.add_python_resource(resource)
```

I'm getting the following error:

```
> pyoxidizer run
resolving 1 targets
resolving target install
resolving target exe
target Python distribution for aarch64-apple-darwin resolves to: https://github.com/indygreg/python-build-standalone/releases/download/20221220/cpython-3.10.9%2B20221220-aarch64-apple-darwin-pgo-full.tar.zst (sha256=5a4a1128f6aa53a2cf6f748d0632da938cca4656c21688fbc564755ec4cd3519)
reusing target Python distribution for host execution
installing modified distutils to /var/folders/s0/1n8754mn5j3_41kzvkg040wh0000gn/T/pyoxidizer-pip-installwKVoak/packages
modifying distutils/_msvccompiler.py for oxidation
modifying distutils/command/build_ext.py for oxidation
modifying distutils/unixccompiler.py for oxidation
pip installing to /var/folders/s0/1n8754mn5j3_41kzvkg040wh0000gn/T/pyoxidizer-pip-installwKVoak/install
Using pip 22.3.1 from /Users/fabioz/Library/Caches/pyoxidizer/python_distributions/python.5a4a1128f6aa/python/install/lib/python3.10/site-packages/pip (python 3.10)
Collecting psutil>=5
Using cached psutil-5.9.7-cp38-abi3-macosx_11_0_arm64.whl (246 kB)
Installing collected packages: psutil
Successfully installed psutil-5.9.7
error[PYOXIDIZER_PYTHON_EXECUTABLE]: adding PythonExtensionModule

Caused by:
resource collector does not allow resources in filesystem-relative
--> ./pyoxidizer.bzl:282:9
|
282 | exe.add_python_resource(resource)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add_python_resource


error: adding PythonExtensionModule

Caused by:
resource collector does not allow resources in filesystem-relative

```

Is there anything I can do to work around this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the macOS aarch64 case from the issue using the configuration in pyoxidizer.bzl, especially line 282 where add_python_resource is called. Start by tracing how the resource collector handles the in-memory and filesystem-relative locations for psutil._psutil_osx. Done means the reported configuration no longer produces the resource-collector error, or a documented workaround is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.