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
magic conda fails in windows (re can not parse path) #14350
Comments
Thanks for your report, @gnosys-scrawford . I think doing By the time the code you highlighted is executing, we're in a path that's commented as "Otherwise, attempt to extract the executable from conda history. " ipython/IPython/core/magics/packaging.py Lines 46 to 57 in 6046a5f
Can you try instead of The Python docs say
>>> p = PurePath('/etc')
>>> str(p)
'/etc'
>>> p = PureWindowsPath('c:/Program Files')
>>> str(p)
'c:\\Program Files' |
Thanks for the response, My suggestion was based primarily that before the latest commit, the search would take place just on the literal string "conda" (no absolute path), and the latest commit comment was just "Implement magic for mamba and micromamba" so switching to I see that in every one of my environment history files, the path to mamba is Even when experimenting on a linux system, I tried creating an environment, activating it, then Oh also, I just noticed that the That's a long-winded way of saying that I think changing If wanting to avoid the exception but keep the functionality of searching environment history with the path (not my recommendation):
|
In a jupyter notebook when trying to run conda or mamba as a magic command, in Windows, it fails. For example
%conda --version
The problem is that in IPython\core\magics\packaging.py, in
_get_conda_like_executable
there iswhere
executable
is aPath
object. In windows, this gets converted to a string with backslashes.re
then tries to treat these backslashes as escape characters and fails. For example, when executable is 'c:\Users\me\mambaforge\envs\myenv\conda' the error will beerror: incomplete escape \U at position 28
I believe the fix is to use
executable.name
instead ofexecutable
in the search string. This will emulate previous versions but I don't know if there are other considerations.The text was updated successfully, but these errors were encountered: