Closed michaelaye closed 5 years ago
I just realized that it doesn't seem to work at all:
(py37) klay6683@MacL2938 ~/src/xonda master $ conda activate py36
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
ModuleNotFoundError: No module named 'conda'
and that's with XONSH_SHOW_TRACEBACK==True already.
Thanks for reporting @michaelaye -- can you post the output of which conda
from within the py37
environment?
before loading xonda:
(py37) klay6683@MacL2938 ~/Dropbox/src $ which -v conda
/Users/klay6683/miniconda3/bin/conda (from PATH element 0)
after loading xonda:
(py37) klay6683@MacL2938 ~/Dropbox/src $ which -v conda
Type: function
String form: <function _xonda at 0x10b3d3ae8>
File: /Users/klay6683/src/xonda/xontrib/xonda.xsh
Definition: (args, stdin=None)
Source:
def _xonda(args, stdin=None):
"""
If command is neither _activate nor _deactivate, just shell out to conda"""
if len(args) == 2 and args[0] in ['activate', 'select']:
_activate(args[1])
elif len(args) == 1 and args[0] is 'deactivate':
_deactivate()
elif len(args) > 0:
@$(which -s conda) @(args)
elif len(args) == 0:
@$(which -s conda) -h
else:
return
Class docstring:
Create a function object.
code
a code object
globals
the globals dictionary
name
a string that overrides the name from the code object
argdefs
a tuple that specifies the default argument values
closure
a tuple that supplies the bindings for free variables
/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/xonsh/__amalgam__.py:18196: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
hdef = oname + inspect.formatargspec(*getargspec(obj))
aliases['conda'] = <function _xonda at 0x10b3d3ae8>
Ahh, ok -- I think I see what's going on. There's a sort of implicit assumption that xonda
is installed into the root conda
environment. But that's easy to work around I think
Can you conda install conda
inside of the py37
environment? Or if that raises an error, you can do a conda install -n py37 conda
from the base environment.
hm, that's an added complexity i'm not sure i'm willing to add to my work process. i'm keeping the base environment (formerly known as 'root') at the defaults channel, but all my envs are from conda-forge. Sometimes the conda's offered at conda-forge go out of sync with the defaults channel, but I don't want to deal with differently behaving condas per [edit:] env, that's just too much.
would it help if I add xonda to the 'base' env instead?
Yes, that should do it
no change. still getting same error as described above.
You need to have a conda installed in the same environment as xonsh is installed. There's not really any way around that given how it's written right now.
but that's the case now. Both conda and xonda are installed in the 'base' env.
# packages in environment at /Users/klay6683/miniconda3:
#
# Name Version Build Channel
asn1crypto 0.24.0 py36_0
ca-certificates 2018.03.07 0
certifi 2018.8.24 py36_1
cffi 1.11.5 py36h6174b99_1
chardet 3.0.4 py36_1
conda 4.5.11 py36_0
conda-env 2.6.0 1
cryptography 2.3.1 py36hdbc3d79_0
idna 2.7 py36_0
libcxx 4.0.1 h579ed51_0
libcxxabi 4.0.1 hebd6815_0
libedit 3.1.20170329 hb402a30_2
libffi 3.2.1 h475c297_4
ncurses 6.1 h0a44026_0
openssl 1.0.2p h1de35cc_0
pip 10.0.1 py36_0
pycosat 0.6.3 py36h1de35cc_0
pycparser 2.19 py36_0
pyopenssl 18.0.0 py36_0
pysocks 1.6.8 py36_0
python 3.6.6 hc167b69_0
python.app 2 py36_9
readline 7.0 h1de35cc_5
requests 2.19.1 py36_0
ruamel_yaml 0.15.46 py36h1de35cc_0
setuptools 40.4.3 py36_0
six 1.11.0 py36_1
sqlite 3.25.2 ha441bb4_0
tk 8.6.8 ha441bb4_0
urllib3 1.23 py36_0
wheel 0.32.1 py36_0
xonda 0.8.0 <pip>
xz 5.2.4 h1de35cc_4
yaml 0.1.7 hc338f04_2
zlib 1.2.11 hf3cbc9b_2
Is xonsh also installed in that environment?
wow, what a mess. I added xonsh, which dragged these packages from 'defaults' channel into 'conda-forge':
ca-certificates
certifi
conda
openssl
then wanted to get xonda from 'conda-forge' to be consistent.
Then realized that the conda-forge package of xonda
still has the deprecation warning and hence I guess won't work with xonsh 0.8.0?
So, then I wanted to remove xonda
again, and it wants to uninstall those packages, even so they are dependents of xonsh
?
$ conda remove xonda (base)
Solving environment: done
## Package Plan ##
environment location: /Users/klay6683/miniconda3
removed specs:
- xonda
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2018.8.24 | py36_1 139 KB
The following packages will be REMOVED:
xonda: 0.2.5-py_0 conda-forge
The following packages will be DOWNGRADED:
ca-certificates: 2018.8.24-ha4d7672_0 conda-forge --> 2018.03.07-0
certifi: 2018.8.24-py36_1001 conda-forge --> 2018.8.24-py36_1
conda: 4.5.11-py36_1000 conda-forge --> 4.5.11-py36_0
openssl: 1.0.2p-h470a237_1 conda-forge --> 1.0.2p-h1de35cc_0
Bizarre.
I just merged the conda-forge PR for the updated xonda
so that should be available soonish (depending on what the conda-forge build queues are like right now).
ha, almost there! The environment now was found and I could activate it, but it threw another deprecation warning (with xonda installed from today's GH master):
(base) klay6683@MacL2938 ~/Dropbox/src $ conda activate p/Users/klay6683/miniconda3/lib/python3.6/site-packages/xonsh/__amalgam__.py:22538: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
rtn = self.loader.exec_module(module)
Found another bug, but that's a new issue.
after this deprecation warning was issued, i now can cleanly change envs with using tab, thanks! (Just the 'base' env is missing).
Ok! So it should work now and it will only throw that warning the first time -- that's an issue with xonsh right now that we need to limit the deprecation warnings to only xonsh-related stuff
Sorry for the environment mess, but I'm glad it's working!
There's a caveat to this solution: If I come from my py37 environment in fish and launch xonsh there, it still throws the initial error. I have to activate the base
env in fish first and THEN launch fish to make things work.
No changes in the PATH definition here. Maybe I can force things to work somehow with the PATH? But the miniconda/bin is already first thing in the PATH, don't know what else could be done.
I'm not sure this is supported, but I'm trying env-name tab completion, and whenever I try it I get this:
I did type:
conda act<tab>
which completes toconda activate
I then addedconda activate p<tab>
to get a list of my environments starting with p, at which point the above Exception occurred. I have 0.8.0 installed, says xpip, on my macOS 10.13.6, using a conda 3.7 env.