Anaconda failure to "solve environment" repeatedly - python

I want to update my python version. When running
conda update python
from my base environment I get the message:
The environment is inconsistent, please check the package plan carefully
and then I get a message about trying to solve using flexible solve, where the terminal just runs without completing.
I have tried everything here and here and all lead to my terminal freezing on the same message.
I have also tried to uninstall conda but the clean command here also leads to freezing.
How can I completely uninstall conda and remove all packages/dependencies and reinstall a new version?

For me the solution was to use navigate to Users/name/opt/ and run
rm -rf ~/anaconda3
which removed the base environment and all scripts related to anaconda and to reinstall using the GUI here for the version of python I needed.
This is the only thing that fixed my problem. Likely there are many packages that I will now need to reinstall...

Related

iPython console in Spyder does not enter in debug

I removed and started with a fresh new installation of Anaconda.
Just after installation I created a custom environment (cust_env)
Both the cust_env and the base environment have Python 3.9.
I then installed on both environments Spyder 5.1.
Now, the problem is the following:
If I run Spyder from the base environment, it seems to work and debug my code normally, while if I run it from the cust_env, when I enter in debug mode the console apparently does not answer anymore (the debug prompt does not appear and you must restart the kernel to have it back again).
I also tryed with different versions of Python (3.7.x and 3.8.x) and of Spyder (4.x, 3.x) and the behaviour looks identical.
I cannot understand what might be the difference which does not allow to use Spyder in an environment different to the base one.
I was able to delimit the problem and find a workaround.
The base problem is that, when you create a new environment of Anaconda, since it contains very few packages (Python and few more), when you afterwards install a new package, it is fully updated with all its dependancies.
In particular
conda install spyder
installs Spyder and all its dependancies at the very last available version.
On the opposite side, the base environment of Anaconda already contains plenty of packages and conda does it best to install the most updated version which is still compatible with the existing packages, but very often it is not the last one.
Now, it appears that Spyder uses QT to show the graphical interface and one of its dependancies qtconsole=5.2.2 has some bug which causes the problem.
When installing Spyder from the base environment, conda installs qtconsole=5.1.1 and the problem does not appear while, if installing from a fresh new environment, qtconsole=5.2.2 is installed and the problem shows up.
Therefore, is is sufficient to downgrade qtconsole
conda install qtconsole=5.1.1
to fix the problem.

Not able to install django and use an existing django project

I am studying Django for the first time and everything was going well until the last day. Today when I tried opening my Django project, the terminal returns an error saying :-
Unable to create process using
'C:\Users\User1\AppData\Local\Programs\Python\Python310\python.exe manage.py runserver'
Thinking that it might be an issue with the virtual env, I tried checking my Python Interpreter to make sure I am currently in my venv.
Fortunately, I am currently using my venv but Pycharm indicates me to Install Python Packaging Tools.
I tried the link to install it but it notifies a Non Zero Exit Code(101) and Invalid Python SDK error.
Googling for the error asked me to check the path in Environment Variables where two are present -
C:\Users\User1\AppData\Local\Programs\Python\Python310\
C:\Users\User1\AppData\Local\Programs\Python\Python310\Scripts\
Recently I had added MingW Compiler to the path and that was it. I've never touched the path of Python.
I would like to mention that there are no errors in creating a new virtual envirnoment nor activating it. But things get worse when I try to pip install django. CMD tells that unable to create process.
Please help! I am actually stuck with my project.
Happy to say that I have fixed the issue.
Steps followed include :
Uninstalled Python,Deleted Path,Restarted my pc
Downloaded and Installed Python 3.10.2 from the official site.
Upgraded pip
Installed virtualenv using pip install virtualenv
Tested it creating env using - py -m venv "environment name"
pip install django works + started a project and the setup was successful.
First, try to run any python file (not in your project).
If it works, then the problem is with your django project or the env (try to create a new env and move your files to it).
At last, I think you should reinstall python; this will fix the problem I guess.

Not able to update anaconda -Error Corrupted Environment

while trying to update the anaconda. I am getting the following error.
I tried to update also, its not working.
How to fix this python error.
CorruptedEnvironmentError: The target environment has been corrupted. Corrupted environments most commonly
occur when the conda process is force-terminated while in an unlink-link
transaction.
environment location: D:\vivek\Learning\Anaconda
corrupted file: D:\vivek\Learning\Anaconda\conda-meta\python-3.7.1-h33f27b4_4.json
Follow the steps below:
Remove all the packages that are corrupt.
Try to install them again(only using conda).
Update your Conda and python if needed.
Try again with different versions if needed.
Extra step: If you have a new conda environment and you find the error is because of some installing issues then try installing Conda again.
This will fix all the errors

I got this error in Python, EnvironmentNotWritable Error

I ran 'conda install pandas-datareader' in Python to get the data.
A EnvironmentNotWritable Error has appeared, as shown below.
I suspect it is due to the (read only) option in base environment, but I do not know how to fix it.
I have just started Python and have little knowledge. I hope you can help me.
I do not know if it's necessary, but the version is like this.
active environment : None
conda version : 4.6.11
conda-build version : 3.17.8
python version : 3.7.3.final.0
base environment : C:\ProgramData\Anaconda3 (read only)
i ran this code
conda install pandas-datareader
During the installation of the package, the following error message appears.
....
Preparing transaction: done
Verifying transaction: failed
EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: C\ProgramData\Anaconda3
Note: you may need to restart the kernel to use updated packages.
There can be two simple issues due to which this issue is generated--
* During installing library your Anaconda program is running. This restricts you to make any changes in environment during working.
Solution-1 Close Anaconda program then try installing library on command prompt.
Solution-2 Close Anaconda program then run Anaconda Prompt as Administrator.
I Hope this will work for you.
Please check the environments tab in the Anaconda if the problem persists after you run it with administrative privileges. in the Environments tab you can create new Environments, just hit create. For example, I created special environment for Rstudio. Whatever you like.
P.S. I checked conda install pandas-datareader on the fresh Anaconda installation and it works. So double check the Environments tab what you have there and install it with administrative rights.
I know I'm replying very early to your question, but still the solution that worked for me is to just run your anaconda prompt in administrator mode.

(virtual env)(global env) why is this happening instead of just (virtual env) when I activate it?

Also from my understanding if I download a package in a virtual environment if I come back to it, will still be there however my django package is gone. why is that?
Yes you have to install it again as a virtualEnv isolate your previous installation
I can't add a comment since I don't have enough reputation but here are a few things you can do to debug this problem.
Check that you activated the correct virtualenv (or pipenv).
Once activated, run pip freeze in the terminal and check if django comes up as one of the packages installed.
If django doesn't show up there, you will need to install it again.

Categories