Skip to content

Only set PYTHONHOME when using conda#411

Closed
yuvipanda wants to merge 1 commit intoJuliaPy:masterfrom
yuvipanda:virtualenv-fixes
Closed

Only set PYTHONHOME when using conda#411
yuvipanda wants to merge 1 commit intoJuliaPy:masterfrom
yuvipanda:virtualenv-fixes

Conversation

@yuvipanda
Copy link
Copy Markdown

Fixes #410

@yuvipanda
Copy link
Copy Markdown
Author

This is my first Julia piece of code (although @tkelman helped a lot!).

Comment thread deps/build.jl
const pyversion_build = $(repr(pyversion))
const PYTHONHOME = "$(escape_string(PYTHONHOME))"
const wPYTHONHOME = $(wstringconst(PYTHONHOME))
const PYTHONHOME = $(PYTHONHOME == nothing ? nothing : "\"" * escape_string(PYTHONHOME) * "\"")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the best way to do this

@yuvipanda
Copy link
Copy Markdown
Author

I've also not actually tested this on Conda!

@yuvipanda yuvipanda mentioned this pull request Jul 11, 2017
2 tasks
Comment thread deps/build.jl
is_windows() ? exec_prefix : pysys(python, "prefix") * ":" * exec_prefix
else
ENV["PYTHONHOME"]
get(ENV, "PYTHONHOME", nothing)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at what Py_SetPythonHome does after we first got this going, maybe it would be easier to do get(ENV, "PYTHONHOME", "") and possibly not need the rest of the patch after this point. Dunno whether a user having the env var PYTHONHOME set to an empty string is sane and should be honored.

@stevengj
Copy link
Copy Markdown
Member

This patch doesn't seem right to me. It seems like we should always call Py_SetPythonHome in PyCall's initialization, since when you do using PyCall you want it to use the python that it was built with and you don't want it to be confused by whatever PYTHONHOME environment variable might happen to be present when you run julia.

It sounds like we might be just setting PYTHONHOME incorrectly in some cases, and the solution is to figure out how to set it correctly?

@iblislin
Copy link
Copy Markdown

iblislin commented Dec 5, 2017

It sounds like we might be just setting PYTHONHOME incorrectly in some cases, and the solution is to figure out how to set it correctly?

In case of venv (with py 3.3+), it will work well without setting PYTHONHOME manually, just let it use the default value.

@yuvipanda
Copy link
Copy Markdown
Author

I think #578 supersedes this.

@yuvipanda yuvipanda closed this Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportError: No module named 'encodings' when using with virtualenv + python3

4 participants