Until yesterday, I had the following setup on my computer. I had Julia 1.9.3 installed. Whenever I wanted to code in Julia or Python I would open the REPL, type using IJulia
and notebook()
. This would open Jupyter Notebook. I would then be able to open a Jupyter Notebook, set the kernel to either “Python 3” or Julia 1.9.3, and then code in either Python or Julia. Within a Python kernel Jupyter Notebook, I was able to run conda install X
and install any Python package. I didn’t have a separate installation of Anaconda or Python.
Yesterday, I was erroneously trying to install the old package pymc3 and repeatedly tried to install the dead Python package theano. Somehow, this managed to ruin my ability to install new Python packages. I would type conda install X
and it wouldn’t work, instead a txt file would spontaneously generate, shown at the bottom.
I googled around and got some suggestions that Python/Anaconda needed to be updated. I then completely uninstalled and reinstalled Julia. In the new installation, I again used REPL and Pkg to add IJulia and run notebook(). This prompted an installation of Jupyter Notebook and I noticed the installer includes an installation of Miniconda.
Right now, I am able to run notebook() and select either a Julia or Python kernel. Python code runs fine and pip install numpy
etc now work, but conda install numpy
gives me an error “The python kernel does not appear to be a conda environment.” “Please use %pip install
instead.” This is not ideal - I’d like conda to be able to handle everything.
I’ve asked ChatGPT to help me troubleshoot but that didn’t work. I’ve installed conda.jl in the REPL. Please help me reinstate the setup I had yesterday. Due to space limitations, I’d rather avoid an entirely new installation of Anaconda/Miniconda and Python, I’d like it to be handled by Julia. After all it seems Julia is downloading Python and Miniconda as a requirement of using Jupyter Notebook.
Edit: I’m on Windows and lack Anaconda prompt. Most online instructions suggest using terminal (Mac/Linux) or Anaconda prompt to set conda environments. But I can’t do that.
# -*- coding: utf-8 -*-
import sys
# Before any more imports, leave cwd out of sys.path for internal 'conda shell.*' commands.
# see https://github.com/conda/conda/issues/6549
if len(sys.argv) > 1 and sys.argv[1].startswith('shell.') and sys.path and sys.path[0] == '':
# The standard first entry in sys.path is an empty string,
# and os.path.abspath('') expands to os.getcwd().
del sys.path[0]
if __name__ == '__main__':
from conda.cli import main
sys.exit(main())