Comments (10)
I hear ya. :) I will try to reproduce this on Linux later and, if that doesn't work, I will disable my System Integrity Protection and see what I can find.
from dotslash.
Out of curiosity, how are you getting/building DotSlash itself?
I just filed #23 and I'm curious if it could be related.
from dotslash.
Hey @bolinfest. I'm definitely not using homebrew in this case. I think I downloaded it directly from the most recent release. I just ensured that I am using the macOS binary listed there and it still fails in the same way:
$ file ~/Downloads/dotslash
/Users/dan/Downloads/dotslash: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
/Users/dan/Downloads/dotslash (for architecture x86_64): Mach-O 64-bit executable x86_64
/Users/dan/Downloads/dotslash (for architecture arm64): Mach-O 64-bit executable arm64
$ /Users/dan/Downloads/dotslash scripts/bin/python
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'scripts/bin/python'
isolated = 0
environment = 1
user site = 1
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = '/install/lib/python3.11'
sys._base_executable = '/Users/dan/devel/backend2/scripts/bin/python'
sys.base_prefix = '/install'
sys.base_exec_prefix = '/install'
sys.platlibdir = 'lib'
sys.executable = '/Users/dan/devel/backend2/scripts/bin/python'
sys.prefix = '/install'
sys.exec_prefix = '/install'
sys.path = [
'/install/lib/python311.zip',
'/install/lib/python3.11',
'/install/lib/python3.11/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000001f235bac0 (most recent call first):
<no Python frame>
FWIW it also still fails with the first release of dotslash:
$ /Users/dan/Downloads/dotslash_old scripts/bin/python
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'scripts/bin/python'
isolated = 0
environment = 1
user site = 1
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = '/install/lib/python3.11'
sys._base_executable = '/Users/dan/devel/backend2/scripts/bin/python'
sys.base_prefix = '/install'
sys.base_exec_prefix = '/install'
sys.platlibdir = 'lib'
sys.executable = '/Users/dan/devel/backend2/scripts/bin/python'
sys.prefix = '/install'
sys.exec_prefix = '/install'
sys.path = [
'/install/lib/python311.zip',
'/install/lib/python3.11',
'/install/lib/python3.11/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000001f235bac0 (most recent call first):
<no Python frame>
from dotslash.
@jazzdan Hmm, while we do rewrite arg0 on both Mac and Linux:
Lines 110 to 111 in 92fe071
I wonder if Python is looking for some resource relative to the executable and we're not convincing it sufficiently?
Also, do you still get this error if you try to use it to run a Python file? Or is it just the REPL case?
from dotslash.
In particular, I'm curious how it is producing that /install
path that it seems to be looking through.
from dotslash.
@bolinfest good question! So --version
works just fine for example:
./scripts/bin/python --version
Python 3.11.8
But ./scripts/bin/python helloworld.py
does not:
$ echo "print('hello world')" > helloworld.py
$ ./scripts/bin/python helloworld.py
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = './scripts/bin/python'
isolated = 0
environment = 1
user site = 1
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = '/install/lib/python3.11'
sys._base_executable = '/Users/dan/devel/backend2/scripts/bin/python'
sys.base_prefix = '/install'
sys.base_exec_prefix = '/install'
sys.platlibdir = 'lib'
sys.executable = '/Users/dan/devel/backend2/scripts/bin/python'
sys.prefix = '/install'
sys.exec_prefix = '/install'
sys.path = [
'/install/lib/python311.zip',
'/install/lib/python3.11',
'/install/lib/python3.11/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000001f235bac0 (most recent call first):
<no Python frame>
And again, running python from the dotslash cache works fine
$ /Users/dan/Library/Caches/dotslash/70/8af721089c037927052d4af721f1618603ad29/python/install/bin/python helloworld.py
hello world
The file type looks correct for my system (darwin arm64) so I think my dotslash file is set up correctly:
file /Users/dan/Library/Caches/dotslash/70/8af721089c037927052d4af721f1618603ad29/python/install/bin/python
/Users/dan/Library/Caches/dotslash/70/8af721089c037927052d4af721f1618603ad29/python/install/bin/python: Mach-O 64-bit executable arm64
Thanks for taking a look!
from dotslash.
If this were Linux, I would say we could use strace
as a first pass to see what sorts of syscalls/file opens DotSlash/Python are trying to do. Unfortunately [IMO], macOS seems to get more and more locked down such that these sorts of observability tools are extremely difficult to get set up to run :(
from dotslash.
This also reproduces on Linux. Here's an strace of executing the dotslash file, and it failing:
https://gist.github.com/jazzdan/f4dd9eb4231a9fd983f85b5056e498b3
Here is an strace of executing the file in the dotslash cache directly, and it succeeding:
https://gist.github.com/jazzdan/71dbd744d680bd14f7e26a434d36fad2
from dotslash.
It looks like I might be running in to this issue here indygreg/python-build-standalone#57 (comment)
the default search path compiled into the binary reflects the build environment instead of the run-time layout.
But I'll admit to being a bit over my head here!
from dotslash.
In this case running the dotslash file like this seems to fix it:
PYTHONHOME=/home/ubuntu/.cache/dotslash/9c/14429f2885b29b37cd1df0c879aff1862b418a/python/install ./python
from dotslash.
Related Issues (20)
- Consider supporting "tar.xz" format HOT 2
- Homebrew release HOT 3
- Misplaced "format" entry not flagged as error HOT 2
- Feature request: a "check" command that verifies the config for all platforms
- Feedbacks on migrating to full dotslash dev env HOT 1
- Latest release and docs should match HOT 3
- Add guide for writing a `Provider`? HOT 4
- Release status? HOT 4
- Fix Homebrew release HOT 2
- Fix CI: macos-13 build appears to be failing HOT 3
- Please don't retag releases HOT 1
- Some tar.gz archives dont decompress correctly
- S3 Provider
- [RFC] configuration file? HOT 3
- Bootstrapping dotslash HOT 2
- Case study: rustc as a dotslash executable, with sysroots
- [RFC] Custom Providers HOT 2
- Support zip in Artifact Format HOT 4
- Add aarch64 to ubuntu release HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotslash.