'Python imports packages not present in environment [duplicate]
After having uninstalled and removed tensorflow, the package is no longer present in the current environment's conda/pip package list. Neither are there any associated files present in the current directory. How then, is it possible to import the tensorflow package without a ModuleNotFoundError ? Strangely, the module can be imported but it is not possible to print its version. What is the explanation for this in python?
Package not found:
(base) $ which python
/Users/foobar/miniforge3/bin/python
(base) $ pip show tensorflow
WARNING: Package(s) not found: tensorflow
(base) $ conda env list
# conda environments:
#
base * /Users/foobar/miniforge3
(base) $ conda list tensorflow --full-name
# packages in environment at /Users/foobar/miniforge3:
#
# Name Version Build Channel
Package not in module list:
(base) $ python3
Python 3.9.10 | packaged by conda-forge | (main, Feb 1 2022, 21:27:43)
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")
Package is able to be imported even though it is not in module list:
>>> import tensorflow as tf
>>> tf.__version__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute '__version__'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
