1

Each time I try to create a python environment with conda it uses my .local/lib/python3.6/site-packages path as the file path for the python packages, I noticed this because when trying to use tensorflow.

this is the command that i use to create the conda env

conda create -n tensorflow_od pip python=3.9

** then activate the environment with

conda activate tensorflow_od

this is what I get when I check the tensorflow that is used within the environment using "pip show tensorflow"

Name: tensorflow Version: 2.3.0 Summary: TensorFlow is an open source machine learning framework for everyone. Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: packages@tensorflow.org License: Apache 2.0 Location: /home/nwoke/.local/lib/python3.6/site-packages Requires: absl-py, astunparse, gast, google-pasta, grpcio, h5py, keras-preprocessing, numpy, opt-einsum, protobuf, scipy, six, tensorboard, tensorflow-estimator, termcolor, wheel, wrapt Required-by: tensorflow-io, tensorflow-text, tf-models-official

How can I resolve this

1 Answers1

0

The question is a little vague to be honest, but here is my understanding of it. You have not used the command conda activate tensorflow_od to activate the virtual environment tensorflow_od. You are calling pip show tensorflow from the base environment which is resulting in /home/nwoke/.local/lib/python3.6/site-packages being shown as your tensorflow location.

Do one thing,

  1. conda activate tensorflow_od use this command to activate your virtual environment.
  2. After you see that your venv is active, pip show tensorflow would give an output of WARNING: Package(s) not found: tensorflow.
  3. conda install -c conda-forge tensorflow.
  4. Then again call pip show tensorflow, it will point to the venv installation of tensorflow.
  • Hello, sorry for not specifying earlier I actually activate the environment with "pip show tensorflow" . Then when I run "pip show tensorflow" within the environment even without installing tensorflow it points to tensorflow in "/home/nwoke/.local/lib/python3.6/site-packages" – Tochukwu Nwoke Jun 13 '22 at 11:53
  • `pip show tensorflow` does not activate the environment. Anyways, it might be possible that pip is pointing to the root installation. To check, open a python instance `import tensorflow as tf` `print(tf.__file__)` it should point to the venv installation of tf – Hetarth Chopra Jun 13 '22 at 13:17