Background
I had some python code in a .py file stored in an R studio project. I was successfully using R studio (version 2022.7.1.554) and the reticulate package (verson 1.26) to write and run the python code. I was using anaconda3 rather than miniconda and all was well. Then I decided to "see what happens" when I open the .py file in VS Code. I think I created a new virtual environment for the project but I'm not really sure, it was a few days ago and my first time using VS code. A few days later I tried running the .py file in R Studio again but I keep getting errors. However, reticulate works fine in other R projects.
Errors and Things I've Tried
This is the error I get:
>reticulate::repl_python()
Error in normalizePath(conda, winslash = "/", mustWork = TRUE) :
path[1]="/Users/myname/opt/anaconda3/lib/python3.9/site-packages/conda/conda": No such file or directory
So I tried to change the coda environment and the python path
#first getting the conda environments
> conda_list()
name python
1 .conda /Users/myname/Desktop/mesa_prisoners/.conda/bin/python
2 base /Users/myname/opt/anaconda3/bin/python
#then setting the conda environments
> use_condaenv(".conda")
Error in normalizePath(conda, winslash = "/", mustWork = TRUE) :
path[1]="/Users/myname/opt/anaconda3/lib/python3.9/site-packages/conda/conda": No such file or directory
> use_condaenv("base")
Warning message:
The request to `use_python("/Users/myname/opt/anaconda3/bin/python")` will be ignored because the environment variable RETICULATE_PYTHON is set to "/Users/myname/Desktop/mesa_prisoners/.conda/bin/python"
> use_python("/Users/myname/opt/anaconda3/bin/python")
Warning message:
The request to `use_python("/Users/myname/opt/anaconda3/bin/python")` will be ignored because the environment variable RETICULATE_PYTHON is set to "/Users/myname/Desktop/mesa_prisoners/.conda/bin/python"
But it doesn't work. I'm new to python so I'm pretty lost here.