Problem in removing a conda created environment

I installed tensorflow using conda create -n tf-gp tensorflow-gpu. Then I activated it using: conda activate tf-gpuThen I uninstalled tensorflow from this environment using:conda uninstall tensorflow

Then I installed tensorflow on the base environment using: conda install -c conda-forge tensorflow-gpu. that installed tensorflow-gpu-1.13.1.

Then I imported python and checked if tensorflow has been installed or not uisng tensorflow.version and I got the following message:

<module 'tensorflow._api.v1.version' from '/home/..../anaconda3/lib/python3.7/site-packages/tensorflow/_api/v1/version/__init__.py'>

Then I uninstalled it using conda remove tensorflow-gpu, I uninstalled tensorflow.

Then I tried to install it using pip via the following command:pip install --upgrade pip pip install tensorflow

Then I checked if tensorflow has bben installed using pip or not by the following command:pip freeze

Then I tried reinstall tensorflow using:conda create -n tf-gpu tensorflow-gpu

Bot the following error drooped out:WARNING: A conda environment already exists at '/home/..../anaconda3/envs/tf-gpu' Remove existing environment (y/[n])? y

And at the end I got the error:Proceed ([y]/n)? y Preparing transaction: done Verifying transaction: failed NoSpaceLeftError: No space left on devices.

and when I checked if it has already been installed I got the following message:ModuleNotFoundError: No module named 'tensorflow'So, I tried to reinstall it using:

conda create -n tf-gpu tensorflow-gpu

but I got the following error:

WARNING: A directory already exists at the target location '/home/..../anaconda3/envs/tf-gpu' but it is not a conda environment. Continue creating environment (y/[n])? y`

When I choose y I got the following error:CondaValueError: prefix already exists: /home/..../anaconda3/envs/tf-gpu

When I try to create a new_env using:

conda create --name new_env tensorflow-gpu

Then I got the following error:

CondaError: Unable to create prefix directory '/home/..../anaconda3/envs/new_env'. Check that you have sufficient permissions.

I tried to install only tensorflow-gpu in this new environment, but I got the following error:

`conda install tensorflow-gpu

DirectoryNotACondaEnvironmentError: The target directory exists, but it is not a conda environment. Use 'conda create' to convert the directory to a conda environment. target directory: /home/.../anaconda3/envs/tf-gp`

And when I try the way that it was explained I got the following error:

CondaValueError: prefix already exists: /home/..../anaconda3/envs/tf-gpu

CondaValueError: prefix already exists: /home/..../anaconda3/envs/tf-gpu`

Now I don't know How I should resolve this problem. Indeed my goal was installing tensorflow using conda but not in a new environment because I had pythorch installed and I had some jupyter notebooks that I wanted to import tensorflow and use some specific libraries. But I fall into a loop of installing and uninstalling that led to this wired problem. The problem is that I can't reinstall tensorflow in the environment that I had created and removed tensorflow from it because it says the environment is not a conda environment and when I try to convert the environment to a conda environment I get the error of prefix. And when I try to create a new environment I get the error of permission.

Any help is really appreciated.

1

1 Answer

Conda creates folders for the environments under ~/miniconda3/envs/ by default. Try navigating to this folder and manually deleting the tensorflow-gpu folder then try again. (If you installed a different version of conda or put it in a different location, navigate to the appropriate location and delete the tensorflow-gpu folder in .../envs/.)

Sometimes I have the issue where conda doesn't quite remove everything and manually deleting the folder fixes it.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like