-
Notifications
You must be signed in to change notification settings - Fork 20
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
nextstrain view can't connect to host on a Mac inside a Conda environment #317
Comments
We've run into variations of this bug before re: Auspice. I had an inkling of it when writing #310 but thought we were well past it. Guess not! Or I misremembered! orz The expectation/intent of the code is that
This sounds simple but is hardish to do right. And the expectation anyways is that |
Relevant Auspice bits that handle this: nextstrain/auspice@8cdbaae |
Ok, it might be not hard as I was thinking we'd have to proxy errors thru from the runtime, but that's mistaken and we always try to resolve the host outside the runtime anyway, so we can catch it there. |
On a macOS that I have access to, it seems a
|
@huddlej I suspect that inside your Conda env, e.g. at some |
Probably from the ctng-compiler-activation and/or clang-compiler-activation packages, which install various activation/deactivation scripts for gcc & co. and clang. Those scripts set Two things I notice about those scripts:
I don't know why those compiler activation packages are getting dragged into your env, probably from some dep, but it's unfortunate when they're used outside of the context of building Conda packages with |
# Create Conda env with ctng-compiler-activation package installed.
$ micromamba create -p /tmp/conda -c conda-forge --override-channels gcc_linux-64
# Set HOST as a *shell variable*.
$ HOST=whunk
# It's visible to the shell…
$ echo $HOST
whunk
# …but not part of the inherited environment (i.e. not exported).
$ python3 -c 'import os; print(os.environ.get("HOST"))'
None
# Activate the Conda environment, which sources the ctng-compiler-activation
# scripts, e.g. /tmp/conda/etc/conda/activate.d/activate-gcc.sh.
$ conda activate /tmp/conda
# The activation script sets HOST…
$ echo $HOST
x86_64-conda-linux-gnu
# …and exports it into the inherited environment.
$ python3 -c 'import os; print(os.environ.get("HOST"))'
x86_64-conda-linux-gnu
# Deactivate the Conda environment, which sources the ctng-compiler-activation
# scripts, e.g. /tmp/conda/etc/conda/deactivate.d/deactivate-gcc.sh.
$ conda deactivate
# The deactivation script restores the old HOST value…
$ echo $HOST
whunk
# …but leaves it exported into the inherited environment.
$ python3 -c 'import os; print(os.environ.get("HOST"))'
whunk |
I'm putting this down for now, satisfied that the impact of this issue will be more limited than not, i.e. it's users of Conda envs with particular packages installed, not all Conda envs (I think) and definitely not all macOS users. I wanted to make sure it wasn't more prudent to quickly revert our change, and I don't think it is. We should still address this issue one way or another, and ideally those conda-forge packages would cut it out when it comes to |
Current Behavior
As of version 7.3.0.post1, I get the following error when trying to run
nextstrain view
:Since the issue occurs since 7.3.0.post and relates to the host or port values, I assumed that it might have originated with #310
My host and port values were:
$HOST
:x86_64-apple-darwin13.4.0
$PORT
is not setWhen I tried to provide the same port as the default, I got the same error:
When I tried to provide the same host as the defaults I did not get the error:
When I tried to provide the same host and port as the defaults, I still did not get the error:
Finally, I tried to provide the same host value as defined in my environment and this produced the error again:
That host name looked unusual, so I checked it and confirmed that it is not a valid host on the network. Searching my environment for host names, I found an odd Conda "backup" host:
This suggested that Conda has mangled my
HOST
variable for some reason. To confirm that this is the case, I started a new terminal session and checked host:That value is my actual host name. Then, I activated a Conda environment and checked host:
Possible solution
For the short term, my personal solution is either to run
nextstrain view
outside of a Conda environment or to explicitly pass--host localhost
to the command. I could also dig into why Conda changes theHOST
variable.For the long term, I don't know how common this issue is for other Mac/Conda users, but it would be nice to retain the original CLI behavior where
localhost
was the default. Maybe the CLI could fallback to "localhost" when the environment value ofHOST
is not valid?Your environment: if running Nextstrain locally
The text was updated successfully, but these errors were encountered: