JuliaPy / JuliaPy/PyCall.jl

Feature Request because of the issue(difficult to add a custom Python version, and packages)

Open
#947 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Hey there currently i´m building a docker julia template i want to share with everyone.
https://github.com/MalteBoehm/julia_docker-compose_template

The current issue is that when i install my own python environment, PyCall adds a HOMEPYTHON Env variable which causes a Fatal Python error and its not possible to unset those variables.

See here:
https://github.com/MalteBoehm/julia_docker-compose_template/blob/main/Dockerfile

My suggestion is to add parameters to PyCall from the very beginning, like Python Version and if should install packages via

environment.yml ->
`conda env create environment.yml
conda activate yourEnviroment`

This is the Error i get:
`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 0x00007f43d5ea5b48 (most recent call first):
Current thread 0x00007f84a9e9bb48 (most recent call first):

Python path configuration:

PYTHONHOME = '/root/.pyenv/versions/3.7.8:/root/.pyenv/versions/3.7.8'

PYTHONPATH = (not set)

program name = '/root/.pyenv/versions/3.7.8/bin/python3'

isolated = 0

environment = 1

user site = 1

import site = 1

sys._base_executable = '/root/.pyenv/versions/3.7.8/bin/python3'

sys.base_prefix = '/root/.pyenv/versions/3.7.8'

sys.base_exec_prefix = '/root/.pyenv/versions/3.7.8'

sys.platlibdir = 'lib'

sys.executable = '/root/.pyenv/versions/3.7.8/bin/python3'

sys.prefix = '/root/.pyenv/versions/3.7.8'

sys.exec_prefix = '/root/.pyenv/versions/3.7.8'

sys.path = [

'/root/.pyenv/versions/3.7.8/lib/python39.zip',

'/root/.pyenv/versions/3.7.8/lib/python3.9',

'/root/.pyenv/versions/3.7.8/lib/python3.9/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'`

Thanks for your help

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.