Importing stix2, ModuleNotFoundError: No module named 'six.moves.collections_abc' - python

I have issues importing the stix2 library regardless of the code I have written.
Following https://github.com/oasis-open/cti-python-stix2, I followed the installations instructions and performed
pip install stix2
I used Anaconda, Jupyter Notebook to run my python script.
When importing stix2
import stix2
I get the error ModuleNotFoundError: No module named 'six.moves.collections_abc'
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-25-2e32347d9df3> in <module>
----> 1 import stix2
~\Anaconda3\lib\site-packages\stix2\__init__.py in <module>
27 from .confidence import scales
28 from .datastore import CompositeDataSource
---> 29 from .datastore.filesystem import (
30 FileSystemSink, FileSystemSource, FileSystemStore,
31 )
~\Anaconda3\lib\site-packages\stix2\datastore\filesystem.py in <module>
9 import six
10
---> 11 from stix2 import v20, v21
12 from stix2.base import _STIXBase
13 from stix2.datastore import (
~\Anaconda3\lib\site-packages\stix2\v20\__init__.py in <module>
15 # flake8: noqa
16
---> 17 from .base import (
18 _DomainObject, _Extension, _Observable, _RelationshipObject, _STIXBase20,
19 )
~\Anaconda3\lib\site-packages\stix2\v20\base.py in <module>
1 """Base classes for STIX 2.0 type definitions."""
2
----> 3 from ..base import (
4 _DomainObject, _Extension, _Observable, _RelationshipObject, _STIXBase,
5 )
~\Anaconda3\lib\site-packages\stix2\base.py in <module>
17 MissingPropertiesError, MutuallyExclusivePropertiesError,
18 )
---> 19 from .markings import _MarkingsMixin
20 from .markings.utils import validate
21 from .utils import (
~\Anaconda3\lib\site-packages\stix2\markings\__init__.py in <module>
20
21
---> 22 from stix2.markings import granular_markings, object_markings
23
24
~\Anaconda3\lib\site-packages\stix2\markings\granular_markings.py in <module>
4 from stix2.markings import utils
5 from stix2.utils import is_marking
----> 6 from stix2.versioning import new_version
7
8
~\Anaconda3\lib\site-packages\stix2\versioning.py in <module>
7
8 import six
----> 9 from six.moves.collections_abc import Mapping
10
11 import stix2.base
ModuleNotFoundError: No module named 'six.moves.collections_abc'
Running the command "pip list" in the user home directory of the Anaconda command prompt verifies that stix2 and six is installed.
Package Version
---------------------------------- ---------
alabaster 0.7.12
anaconda-client 1.7.2
anaconda-navigator 1.9.7
anaconda-project 0.8.3
antlr4-python3-runtime 4.8
asn1crypto 1.0.1
astropy 3.2.1
atomicwrites 1.3.0
attackcti 0.3.3
attrs 19.2.0
Babel 2.7.0
backcall 0.1.0
backports.functools-lru-cache 1.5
backports.os 0.1.1
backports.shutil-get-terminal-size 1.0.0
backports.tempfile 1.0
backports.weakref 1.0.post1
beautifulsoup4 4.8.0
bitarray 1.0.1
bkcharts 0.2
bleach 3.1.0
bokeh 1.3.4
boto 2.49.0
Bottleneck 1.2.1
certifi 2019.9.11
cffi 1.12.3
chardet 3.0.4
Click 7.0
cloudpickle 1.2.2
clyent 1.2.2
colorama 0.4.1
comtypes 1.1.7
conda 4.7.12
conda-build 3.18.9
conda-package-handling 1.6.0
conda-verify 3.4.2
contextlib2 0.6.0
cryptography 2.7
cycler 0.10.0
Cython 0.29.13
cytoolz 0.10.0
dask 2.5.2
decorator 4.4.0
defusedxml 0.6.0
distributed 2.5.2
docutils 0.15.2
entrypoints 0.3
et-xmlfile 1.0.1
fastcache 1.1.0
filelock 3.0.12
Flask 1.1.1
fsspec 0.5.2
future 0.17.1
gevent 1.4.0
glob2 0.7
greenlet 0.4.15
h5py 2.9.0
HeapDict 1.0.1
html5lib 1.0.1
idna 2.8
imageio 2.6.0
imagesize 1.1.0
importlib-metadata 0.23
ipykernel 5.1.2
ipython 7.8.0
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 4.3.21
itsdangerous 1.1.0
jdcal 1.4.1
jedi 0.15.1
Jinja2 2.10.3
joblib 0.13.2
json5 0.8.5
jsonschema 3.0.2
jupyter 1.0.0
jupyter-client 5.3.3
jupyter-console 6.0.0
jupyter-core 4.5.0
jupyterlab 1.1.4
jupyterlab-server 1.0.6
keyring 18.0.0
kiwisolver 1.1.0
lazy-object-proxy 1.4.2
libarchive-c 2.8
llvmlite 0.29.0
locket 0.2.0
lxml 4.4.1
MarkupSafe 1.1.1
matplotlib 3.1.1
mccabe 0.6.1
menuinst 1.4.16
mistune 0.8.4
mkl-fft 1.0.14
mkl-random 1.1.0
mkl-service 2.3.0
mock 3.0.5
more-itertools 7.2.0
mpmath 1.1.0
msgpack 0.6.1
multipledispatch 0.6.0
navigator-updater 0.2.1
nbconvert 5.6.0
nbformat 4.4.0
networkx 2.3
nltk 3.4.5
nose 1.3.7
notebook 6.0.1
numba 0.45.1
numexpr 2.7.0
numpy 1.16.5
numpydoc 0.9.1
olefile 0.46
openpyxl 3.0.0
packaging 19.2
pandas 0.25.1
pandocfilters 1.4.2
parso 0.5.1
partd 1.0.0
path.py 12.0.1
pathlib2 2.3.5
patsy 0.5.1
pep8 1.7.1
pickleshare 0.7.5
Pillow 6.2.0
pip 20.2.4
pkginfo 1.5.0.1
pluggy 0.13.0
ply 3.11
prometheus-client 0.7.1
prompt-toolkit 2.0.10
psutil 5.6.3
py 1.8.0
pycodestyle 2.5.0
pycosat 0.6.3
pycparser 2.19
pycrypto 2.6.1
pycurl 7.43.0.3
pyflakes 2.1.1
Pygments 2.4.2
pylint 2.4.2
pyodbc 4.0.27
pyOpenSSL 19.0.0
pyparsing 2.4.2
pyreadline 2.1
pyrsistent 0.15.4
PySocks 1.7.1
pytest 5.2.1
pytest-arraydiff 0.3
pytest-astropy 0.5.0
pytest-doctestplus 0.4.0
pytest-openfiles 0.4.0
pytest-remotedata 0.3.2
python-dateutil 2.8.0
pytz 2019.3
PyWavelets 1.0.3
pywin32 223
pywinpty 0.5.5
PyYAML 5.1.2
pyzmq 18.1.0
QtAwesome 0.6.0
qtconsole 4.5.5
QtPy 1.9.0
requests 2.22.0
rope 0.14.0
ruamel-yaml 0.15.46
scikit-image 0.15.0
scikit-learn 0.21.3
scipy 1.3.1
seaborn 0.9.0
Send2Trash 1.5.0
setuptools 41.4.0
simplegeneric 0.8.1
simplejson 3.17.2
singledispatch 3.4.0.3
six 1.15.0
snowballstemmer 2.0.0
sortedcollections 1.1.2
sortedcontainers 2.1.0
soupsieve 1.9.3
Sphinx 2.2.0
sphinxcontrib-applehelp 1.0.1
sphinxcontrib-devhelp 1.0.1
sphinxcontrib-htmlhelp 1.0.2
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.2
sphinxcontrib-serializinghtml 1.1.3
sphinxcontrib-websupport 1.1.2
spyder 3.3.6
spyder-kernels 0.5.2
SQLAlchemy 1.3.9
statsmodels 0.10.1
stix2 2.0.2
stix2-patterns 1.3.1
sympy 1.4
tables 3.5.2
taxii2-client 2.2.2
tblib 1.4.0
terminado 0.8.2
testpath 0.4.2
toolz 0.10.0
tornado 6.0.3
tqdm 4.36.1
traitlets 4.3.3
typed-ast 1.4.1
unicodecsv 0.14.1
urllib3 1.24.2
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
widgetsnbextension 3.5.1
win-inet-pton 1.1.0
win-unicode-console 0.5
wincertstore 0.2
wrapt 1.11.2
xlrd 1.2.0
XlsxWriter 1.2.1
xlwings 0.15.10
xlwt 1.3.0
zict 1.0.0
zipp 0.6.0
I have also tried
pip install --ignore-installed six
From this link:
ModuleNotFoundError: No module named 'six.moves.collections_abc'
But it still does not work. What's the issue?

go to https://pypi.org/project/six/#files
download "six-1.14.0.tar.gz (33.9 kB)"
unzip it, copy and paste "six.py" into your source directory
import "six" module into your source code(import six)
run source script.

Created a new python script and ran the code there instead. It worked. Weird bug.

Related

Unable to launch Spyder IDE Linux. Error: PyQt5 5.9+ is required (found None)

I am running Spyder IDE on Red Hat Linux. I installed Spyder in a virtual environment as outlined https://docs.spyder-ide.org/current/installation.html and this was running without a problem. I now following message when I launch
Traceback (most recent call last):
File "/home/<my_name>/spyder-env/bin/spyder", line 8, in <module>
sys.exit(main())
File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/app/start.py", line 248, in main
from spyder.app import mainwindow
File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/app/mainwindow.py", line 41, in <module>
requirements.check_qt()
File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/requirements.py", line 54, in check_qt
show_warning("Please check Spyder installation requirements:\n"
File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/requirements.py", line 32, in show_warning
raise RuntimeError(message)
RuntimeError: Please check Spyder installation requirements:
PyQt5 5.9+ is required (found None).
Here are a list of packages and versions I have installed, with PyQT5
python3 -m pip list
Package Version
----------------------------- -------------------
absl-py 1.0.0
alabaster 0.7.12
arrow 1.2.2
astroid 2.11.3
asttokens 2.0.5
astunparse 1.6.3
atomicwrites 1.4.0
attrs 21.4.0
autopep8 1.6.0
Babel 2.10.1
backcall 0.2.0
beautifulsoup4 4.11.1
binaryornot 0.4.4
black 22.3.0
bleach 5.0.0
cachetools 5.0.0
certifi 2021.10.8
cffi 1.15.0
chardet 4.0.0
charset-normalizer 2.0.12
click 8.1.3
cloudpickle 2.0.0
cookiecutter 1.7.3
cryptography 37.0.1
cycler 0.11.0
deap 1.3.1
debugpy 1.6.0
decorator 5.1.1
defusedxml 0.7.1
Deprecated 1.2.13
diff-match-patch 20200713
dill 0.3.4
docutils 0.17.1
entrypoints 0.4
executing 0.8.3
fastjsonschema 2.15.3
flake8 4.0.1
flatbuffers 2.0
fonttools 4.33.3
gast 0.5.3
google-auth 2.6.6
google-auth-oauthlib 0.4.6
google-pasta 0.2.0
grpcio 1.44.0
h5py 3.6.0
idna 3.3
imagesize 1.3.0
imbalanced-learn 0.9.0
imblearn 0.0
importlib-metadata 4.11.3
inflection 0.5.1
intervaltree 3.1.0
ipykernel 6.13.0
ipython 7.32.0
ipython-genutils 0.2.0
isort 5.10.1
jedi 0.18.1
jeepney 0.8.0
jellyfish 0.9.0
Jinja2 3.0.3
jinja2-time 0.2.0
joblib 1.1.0
jsonschema 4.4.0
jupyter_client 7.3.5
jupyter-core 4.10.0
jupyterlab-pygments 0.2.2
keras 2.8.0
Keras-Preprocessing 1.1.2
keyring 23.5.0
kiwisolver 1.4.2
lazy-object-proxy 1.7.1
libclang 14.0.1
llvmlite 0.38.1
Markdown 3.3.6
MarkupSafe 2.1.1
matplotlib 3.5.1
matplotlib-inline 0.1.3
mccabe 0.6.1
mistune 0.8.4
mypy-extensions 0.4.3
nbclient 0.6.0
nbconvert 6.5.0
nbformat 5.3.0
nest-asyncio 1.5.5
numba 0.55.2
numpy 1.21.6
numpydoc 1.2.1
oauthlib 3.2.0
opt-einsum 3.3.0
packaging 21.3
pandas 1.4.3
pandocfilters 1.5.0
parso 0.8.3
pathspec 0.9.0
patsy 0.5.2
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.1.0
pip 22.2.2
platformdirs 2.5.2
pluggy 1.0.0
poyo 0.5.0
prompt-toolkit 3.0.29
protobuf 3.20.1
psutil 5.9.0
ptyprocess 0.7.0
pure-eval 0.2.2
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycodestyle 2.8.0
pycparser 2.21
pydocstyle 6.1.1
pyflakes 2.4.0
Pygments 2.12.0
pylint 2.13.7
pyls-spyder 0.4.0
PyOpenGL 3.1.6
pyparsing 3.0.8
PyQt5 5.12.3
PyQt5-Qt5 5.15.2
PyQt5-sip 12.10.1
PyQtWebEngine 5.12.1
PyQtWebEngine-Qt5 5.15.2
pyrsistent 0.18.1
python-dateutil 2.8.2
python-lsp-black 1.2.1
python-lsp-jsonrpc 1.0.0
python-lsp-server 1.5.0
python-slugify 6.1.2
pytz 2022.1
pyxdg 0.27
pyzmq 24.0.1
QDarkStyle 3.0.3
qstylizer 0.2.1
QtAwesome 1.1.1
qtconsole 5.3.2
QtPy 2.1.0
requests 2.27.1
requests-oauthlib 1.3.1
rope 1.0.0
rsa 4.8
Rtree 1.0.0
scikeras 0.9.0
scikit-learn 1.0.2
scipy 1.8.0
seaborn 0.11.2
SecretStorage 3.3.2
setuptools 50.3.2
six 1.16.0
sklearn 0.0
sktime 0.12.0
snowballstemmer 2.2.0
sortedcontainers 2.4.0
soupsieve 2.3.2.post1
Sphinx 4.5.0
sphinxcontrib-applehelp 1.0.2
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 2.0.0
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder 5.3.3
spyder-kernels 2.3.3
statsmodels 0.13.2
stopit 1.1.2
tensorboard 2.8.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorflow 2.8.0
tensorflow-io-gcs-filesystem 0.25.0
termcolor 1.1.0
text-unidecode 1.3
textdistance 4.2.2
tf-estimator-nightly 2.8.0.dev2021122109
threadpoolctl 3.1.0
three-merge 0.1.1
tinycss2 1.1.1
toml 0.10.2
tomli 2.0.1
torch 1.11.0
torchaudio 0.11.0
torchvision 0.12.0
tornado 6.2
TPOT 0.11.7
tqdm 4.64.0
traitlets 5.1.1
typing_extensions 4.2.0
ujson 5.2.0
update-checker 0.18.0
urllib3 1.26.9
varname 0.8.3
watchdog 2.1.9
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 2.1.2
whatthepatch 1.0.2
wheel 0.37.1
wrapt 1.14.0
wurlitzer 3.0.2
xgboost 1.6.0
yapf 0.32.0
zipp 3.8.0
This is on a shared machine, is it possible that someone could have changed something to cause the error? Does anyone have a fix?
Unsetting the library path seemed to resolve the issue. Something local on the machine was going wrong.
unset LD_LIBRARY_PATH

Why is python constantly saying 'ModuleNotFoundError' for a library import when it clearly exists through Anaconda? [duplicate]

This question already has answers here:
How to add package to conda environment without pip
(5 answers)
Closed 1 year ago.
I am trying to use matplotlib and pandas in one of my projects, and the error message I get is confusing me. I have done anything I can to resolve it, but it still doesn't work. There might be a problem with my Anaconda (i am using anaconda python) distribution or a problem with the path, but I checked and the path seemed to point to Anaconda
Every time I write this code:
import matplotlib as plt
import pandas as pd
it says there is an error. The error is:
PS C:\Users\mghaf\Documents\GitHub\Modelling-Cell-Growth-in-CFU> & C:/Users/mghaf/Anaconda3/envs/rstudio/python.exe c:/Users/mghaf/Documents/GitHub/Modelling-Cell-Growth-in-CFU/test.py
Traceback (most recent call last):
File "c:/Users/mghaf/Documents/GitHub/Modelling-Cell-Growth-in-CFU/test.py", line 1, in <module>
import matplotlib as plt
ModuleNotFoundError: No module named 'matplotlib'
And for Pandas:
PS C:\Users\mghaf\Documents\GitHub\Modelling-Cell-Growth-in-CFU> & C:/Users/mghaf/Anaconda3/envs/rstudio/python.exe c:/Users/mghaf/Documents/GitHub/Modelling-Cell-Growth-in-CFU/test.py
Traceback (most recent call last):
File "c:/Users/mghaf/Documents/GitHub/Modelling-Cell-Growth-in-CFU/test.py", line 2, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
In vscode, I have checked all the libraries that I have, and it seems that I have everything, yet it still says module not found.
# packages in environment at C:\Users\mghaf\Anaconda3:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py38_0
alabaster 0.7.12 py_0
anaconda 2020.11 py38_0
anaconda-client 1.7.2 py38_0
anaconda-navigator 2.0.4 py38_0
anaconda-project 0.8.4 py_0
argh 0.26.2 py38_0
argon2-cffi 20.1.0 py38he774522_1
asn1crypto 1.4.0 py_0
astroid 2.4.2 py38_0
astropy 4.0.2 py38he774522_0
async_generator 1.10 py_0
atomicwrites 1.4.0 py_0
attrs 20.3.0 pyhd3eb1b0_0
autopep8 1.5.4 py_0
babel 2.8.1 pyhd3eb1b0_0
backcall 0.2.0 py_0
backports 1.0 py_2
backports.functools_lru_cache 1.6.1 py_0
backports.shutil_get_terminal_size 1.0.0 py38_2
backports.tempfile 1.0 py_1
backports.weakref 1.0.post1 py_1
bcrypt 3.2.0 py38he774522_0
beautifulsoup4 4.9.3 pyhb0f4dca_0
bitarray 1.6.1 py38h2bbff1b_0
bkcharts 0.2 py38_0
blas 1.0 mkl
bleach 3.2.1 py_0
blosc 1.20.1 h7bd577a_0
bokeh 2.2.3 py38_0
boto 2.49.0 py38_0
bottleneck 1.3.2 py38h2a96729_1
brotlipy 0.7.0 py38he774522_1000
bzip2 1.0.8 he774522_0
ca-certificates 2020.10.14 0
certifi 2020.6.20 pyhd3eb1b0_3
cffi 1.14.3 py38h7a1dbc1_0
chardet 3.0.4 py38_1003
click 7.1.2 py_0
cloudpickle 1.6.0 py_0
clyent 1.2.2 py38_1
colorama 0.4.4 py_0
comtypes 1.1.7 py38_1001
conda 4.10.3 py38haa95532_0
conda-build 3.20.5 py38_1
conda-content-trust 0.1.1 pyhd3eb1b0_0
conda-env 2.6.0 1
conda-package-handling 1.7.2 py38h76e460a_0
conda-repo-cli 1.0.4 pyhd3eb1b0_0
conda-token 0.3.0 pyhd3eb1b0_0
conda-verify 3.4.2 py_1
console_shortcut 0.1.1 4
contextlib2 0.6.0.post1 py_0
cryptography 3.1.1 py38h7a1dbc1_0
curl 7.71.1 h2a8f88b_1
cycler 0.10.0 py38_0
cython 0.29.21 py38ha925a31_0
cytoolz 0.11.0 py38he774522_0
dask 2.30.0 py_0
dask-core 2.30.0 py_0
decorator 4.4.2 py_0
defusedxml 0.6.0 py_0
diff-match-patch 20200713 py_0
distributed 2.30.1 py38haa95532_0
docutils 0.16 py38_1
entrypoints 0.3 py38_0
et_xmlfile 1.0.1 py_1001
fastcache 1.1.0 py38he774522_0
filelock 3.0.12 py_0
flake8 3.8.4 py_0
flask 1.1.2 py_0
freetype 2.10.4 hd328e21_0
fsspec 0.8.3 py_0
future 0.18.2 py38_1
get_terminal_size 1.0.0 h38e98db_0
gevent 20.9.0 py38he774522_0
glob2 0.7 py_0
greenlet 0.4.17 py38he774522_0
h5py 2.10.0 py38h5e291fa_0
hdf5 1.10.4 h7ebc959_0
heapdict 1.0.1 py_0
html5lib 1.1 py_0
icc_rt 2019.0.0 h0cc432a_1
icu 58.2 ha925a31_3
idna 2.10 py_0
imageio 2.9.0 py_0
imagesize 1.2.0 py_0
importlib-metadata 2.0.0 py_1
importlib_metadata 2.0.0 1
iniconfig 1.1.1 py_0
intel-openmp 2020.2 254
intervaltree 3.1.0 py_0
ipykernel 5.3.4 py38h5ca1d4c_0
ipython 7.19.0 py38hd4e2768_0
ipython_genutils 0.2.0 py38_0
ipywidgets 7.5.1 py_1
isort 5.6.4 py_0
itsdangerous 1.1.0 py_0
jdcal 1.4.1 py_0
jedi 0.17.1 py38_0
jinja2 2.11.2 py_0
joblib 0.17.0 py_0
jpeg 9b hb83a4c4_2
json5 0.9.5 py_0
jsonschema 3.2.0 py_2
jupyter 1.0.0 py38_7
jupyter_client 6.1.7 py_0
jupyter_console 6.2.0 py_0
jupyter_core 4.6.3 py38_0
jupyterlab 2.2.6 py_0
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 1.2.0 py_0
keyring 21.4.0 py38_1
kiwisolver 1.3.0 py38hd77b12b_0
krb5 1.18.2 hc04afaa_0
lazy-object-proxy 1.4.3 py38he774522_0
libarchive 3.4.2 h5e25573_0
libcurl 7.71.1 h2a8f88b_1
libiconv 1.15 h1df5818_7
liblief 0.10.1 ha925a31_0
libpng 1.6.37 h2a8f88b_0
libsodium 1.0.18 h62dcd97_0
libspatialindex 1.9.3 h33f27b4_0
libssh2 1.9.0 h7a1dbc1_1
libtiff 4.1.0 h56a325e_1
libxml2 2.9.10 hb89e7f3_3
libxslt 1.1.34 he774522_0
llvmlite 0.34.0 py38h1a82afc_4
locket 0.2.0 py38_1
lxml 4.6.1 py38h1350720_0
lz4-c 1.9.2 hf4a77e7_3
lzo 2.10 he774522_2
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markupsafe 1.1.1 py38he774522_0
matplotlib 3.3.2 0
matplotlib-base 3.3.2 py38hba9282a_0
mccabe 0.6.1 py38_1
menuinst 1.4.16 py38he774522_1
mistune 0.8.4 py38he774522_1000
mkl 2020.2 256
mkl-service 2.3.0 py38hb782905_0
mkl_fft 1.2.0 py38h45dec08_0
mkl_random 1.1.1 py38h47e9c7a_0
mock 4.0.2 py_0
more-itertools 8.6.0 pyhd3eb1b0_0
mpmath 1.1.0 py38_0
msgpack-python 1.0.0 py38h74a9793_1
msys2-conda-epoch 20160418 1
multipledispatch 0.6.0 py38_0
navigator-updater 0.2.1 py38_0
nbclient 0.5.1 py_0
nbconvert 6.0.7 py38_0
nbformat 5.0.8 py_0
nest-asyncio 1.4.2 pyhd3eb1b0_0
networkx 2.5 py_0
nltk 3.5 py_0
nose 1.3.7 py38_2
notebook 6.1.4 py38_0
numba 0.51.2 py38hf9181ef_1
numexpr 2.7.1 py38h25d0782_0
numpy 1.19.2 py38hadc3359_0
numpy-base 1.19.2 py38ha3acd2a_0
numpydoc 1.1.0 pyhd3eb1b0_1
olefile 0.46 py_0
openpyxl 3.0.5 py_0
openssl 1.1.1h he774522_0
packaging 20.4 py_0
pandas 1.1.3 py38ha925a31_0
pandoc 2.11 h9490d1a_0
pandocfilters 1.4.3 py38haa95532_1
paramiko 2.7.2 py_0
parso 0.7.0 py_0
partd 1.1.0 py_0
path 15.0.0 py38_0
path.py 12.5.0 0
pathlib2 2.3.5 py38_0
pathtools 0.1.2 py_1
patsy 0.5.1 py38_0
pep8 1.7.1 py38_0
pexpect 4.8.0 py38_0
pickleshare 0.7.5 py38_1000
pillow 8.0.1 py38h4fa10fc_0
pip 20.2.4 py38haa95532_0
pkginfo 1.6.1 py38haa95532_0
pluggy 0.13.1 py38_0
ply 3.11 py38_0
powershell_shortcut 0.0.1 3
prometheus_client 0.8.0 py_0
prompt-toolkit 3.0.8 py_0
prompt_toolkit 3.0.8 0
psutil 5.7.2 py38he774522_0
py 1.9.0 py_0
py-lief 0.10.1 py38ha925a31_0
pycodestyle 2.6.0 py_0
pycosat 0.6.3 py38he774522_0
pycparser 2.20 py_2
pycurl 7.43.0.6 py38h7a1dbc1_0
pydocstyle 5.1.1 py_0
pyflakes 2.2.0 py_0
pygments 2.7.2 pyhd3eb1b0_0
pylint 2.6.0 py38_0
pynacl 1.4.0 py38h62dcd97_1
pyodbc 4.0.30 py38ha925a31_0
pyopenssl 19.1.0 py_1
pyparsing 2.4.7 py_0
pyqt 5.9.2 py38ha925a31_4
pyreadline 2.1 py38_1
pyrsistent 0.17.3 py38he774522_0
pysocks 1.7.1 py38_0
pytables 3.6.1 py38ha5be198_0
pytest 6.1.1 py38_0
python 3.8.5 h5fd99cc_1
python-dateutil 2.8.1 py_0
python-jsonrpc-server 0.4.0 py_0
python-language-server 0.35.1 py_0
python-libarchive-c 2.9 py_0
pytz 2020.1 py_0
pywavelets 1.1.1 py38he774522_2
pywin32 227 py38he774522_1
pywin32-ctypes 0.2.0 py38_1000
pywinpty 0.5.7 py38_0
pyyaml 5.3.1 py38he774522_1
pyzmq 19.0.2 py38ha925a31_1
qdarkstyle 2.8.1 py_0
qt 5.9.7 vc14h73c81de_0
qtawesome 1.0.1 py_0
qtconsole 4.7.7 py_0
qtpy 1.9.0 py_0
regex 2020.10.15 py38he774522_0
requests 2.24.0 py_0
rope 0.18.0 py_0
rtree 0.9.4 py38h21ff451_1
ruamel_yaml 0.15.87 py38he774522_1
scikit-image 0.17.2 py38h1e1f486_0
scikit-learn 0.23.2 py38h47e9c7a_0
scipy 1.5.2 py38h14eb087_0
seaborn 0.11.0 py_0
send2trash 1.5.0 py38_0
setuptools 50.3.1 py38haa95532_1
simplegeneric 0.8.1 py38_2
singledispatch 3.4.0.3 py_1001
sip 4.19.13 py38ha925a31_0
six 1.15.0 py38haa95532_0
snowballstemmer 2.0.0 py_0
sortedcollections 1.2.1 py_0
sortedcontainers 2.2.2 py_0
soupsieve 2.0.1 py_0
sphinx 3.2.1 py_0
sphinxcontrib 1.0 py38_1
sphinxcontrib-applehelp 1.0.2 py_0
sphinxcontrib-devhelp 1.0.2 py_0
sphinxcontrib-htmlhelp 1.0.3 py_0
sphinxcontrib-jsmath 1.0.1 py_0
sphinxcontrib-qthelp 1.0.3 py_0
sphinxcontrib-serializinghtml 1.1.4 py_0
sphinxcontrib-websupport 1.2.4 py_0
spyder 4.1.5 py38_0
spyder-kernels 1.9.4 py38_0
sqlalchemy 1.3.20 py38h2bbff1b_0
sqlite 3.33.0 h2a8f88b_0
statsmodels 0.12.0 py38he774522_0
sympy 1.6.2 py38haa95532_1
tblib 1.7.0 py_0
terminado 0.9.1 py38_0
testpath 0.4.4 py_0
threadpoolctl 2.1.0 pyh5ca1d4c_0
tifffile 2020.10.1 py38h8c2d366_2
tk 8.6.10 he774522_0
toml 0.10.1 py_0
toolz 0.11.1 py_0
tornado 6.0.4 py38he774522_1
tqdm 4.50.2 py_0
traitlets 5.0.5 py_0
typing_extensions 3.7.4.3 py_0
ujson 4.0.1 py38ha925a31_0
unicodecsv 0.14.1 py38_0
urllib3 1.25.11 py_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_3
watchdog 0.10.3 py38_0
wcwidth 0.2.5 py_0
webencodings 0.5.1 py38_1
werkzeug 1.0.1 py_0
wheel 0.35.1 py_0
widgetsnbextension 3.5.1 py38_0
win_inet_pton 1.1.0 py38_0
win_unicode_console 0.5 py38_0
wincertstore 0.2 py38_0
winpty 0.4.3 4
wrapt 1.11.2 py38he774522_0
xlrd 1.2.0 py_0
xlsxwriter 1.3.7 py_0
xlwings 0.20.8 py38_0
xlwt 1.3.0 py38_0
xmltodict 0.12.0 py_0
xz 5.2.5 h62dcd97_0
yaml 0.2.5 he774522_0
yapf 0.30.0 py_0
zeromq 4.3.2 ha925a31_3
zict 2.0.0 py_0
zipp 3.4.0 pyhd3eb1b0_0
zlib 1.2.11 h62dcd97_4
zope 1.0 py38_1
zope.event 4.5.0 py38_0
zope.interface 5.1.2 py38he774522_0
zstd 1.4.5 h04227a9_0
As you can see, matplotlib and pandas are there.
I a using anaconda to get my libraries. I am using Vscode for writing the program.
Maybe I need to do a complete uninstall of python and any attributes to it, and then install anything I need back to get a fresh system?
I can see that the packages already exist in your base environment so there is no need to install any additional packages for now.
First you need to add anaconda to your path.
Please head here and scroll down to add anaconda to path (optional) https://www.datacamp.com/community/tutorials/installing-anaconda-windows and follow the instructions.
Once that it done, You need to type conda activate base in your command prompt and hit enter, then you can type code and you can launch your development environment.
Alternatively, you can look for anaconda prompt within the start button and launch it, it will automatically go into the anaconda base environment, then you can try to launch code by typing code.
If you can’t launch code, you can head here and follow the instructions to add vs code to your path, How to start Visual Studio Code within Anaconda Env just follow the steps in the first answer.
Then open a new CMD prompt and try typing the activate and code commands from above again or launching the anaconda prompt from within the start button again.
Alternatively, you can also add the anaconda environment directly into vs code using the following steps.
1 Ctrl + shift + P
2 Search Select Interpreter
3 Select it and it will show you the list of your virtual environment created via conda and other python versions
4 select the environment and you are ready to go.
Then you will be able to launch into your anaconda environment either by using the command prompt, activating the environment and launching code. Or you can launch code directly and select the anaconda environment from within.
You need to understand what anaconda is, it is just an environment creator and package manager. Each environment has its own packages you can control and destroy when you are done, it ensures that your environments are sandboxed so that they don’t affect one another or your system.
I recommend that you create a new environment, not use the base environment to do your work, to do this you can type conda create -n name where name is the name of the environment you can put whatever you want. After that you can do conda install pandas matplotlib etc and instead of launching into base you can now conda activate name and launch into this environment instead.
From your comment, the environment where the packages are installed in, and the interpreter you want to use are different.
Please do the following from an Anaconda command prompt.
conda activate rstudio
pip install matplotlib
pip install pandas

AttributeError: could not import keras and segmentation models

I am trying to import segmentation models and keras and i am getting an attribute error, i am using tensor flow version 2.5.0
import tensorflow as tf
import segmentation_models as sm
import glob
import cv2
import os
import numpy as np
from matplotlib import pyplot as plt
import keras
from keras.utils import normalize
from keras.metrics import MeanIoU
Attribute error :
AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'
I tried installing tensorflow 2.1.0 version to solve the issue as recommended in other question, but still the problem persists, any suggestion is greatly appreciated.
As suggested in comments , i am updating output of pip list
pip list :
pip list
Package Version
---------------------------------- -------------------
absl-py 0.12.0
alabaster 0.7.12
anaconda-client 1.8.0
anaconda-navigator 2.0.3
anaconda-project 0.10.0
antlr4-python3-runtime 4.8
anyio 2.2.0
appdirs 1.4.4
argh 0.26.2
argon2-cffi 20.1.0
arrow 0.13.1
asn1crypto 1.4.0
astroid 2.6.0
astropy 4.2.1
astunparse 1.6.3
async-generator 1.10
atomicwrites 1.4.0
attrs 21.2.0
autopep8 1.5.6
Babel 2.9.1
backcall 0.2.0
backports.functools-lru-cache 1.6.4
backports.shutil-get-terminal-size 1.0.0
backports.tempfile 1.0
backports.weakref 1.0.post1
beautifulsoup4 4.9.3
binaryornot 0.4.4
bitarray 2.1.0
bkcharts 0.2
black 21.4b2
bleach 3.3.0
bokeh 2.3.2
boto 2.49.0
Bottleneck 1.3.2
brotlipy 0.7.0
cachetools 4.2.2
certifi 2021.5.30
cffi 1.14.5
chardet 4.0.0
click 8.0.1
cloudpickle 1.6.0
clyent 1.2.2
colorama 0.4.4
conda 4.10.1
conda-build 3.21.4
conda-content-trust 0+unknown
conda-pack 0.6.0
conda-package-handling 1.7.3
conda-repo-cli 1.0.4
conda-token 0.3.0
conda-verify 3.4.2
contextlib2 0.6.0.post1
cookiecutter 1.7.2
cryptography 3.4.7
cycler 0.10.0
Cython 0.29.23
cytoolz 0.11.0
dask 2021.6.2
decorator 4.4.2
defusedxml 0.7.1
detectron2 0.4.1
diff-match-patch 20200713
distributed 2021.6.2
docutils 0.17.1
efficientnet 1.0.0
entrypoints 0.3
et-xmlfile 1.1.0
fast-slic 0.4.0
fastcache 1.1.0
filelock 3.0.12
flake8 3.9.0
Flask 1.1.2
flatbuffers 1.12
fsspec 2021.6.0
future 0.18.2
fvcore 0.1.5.post20210609
gast 0.4.0
gco-wrapper 3.0.7
gevent 21.1.2
glob2 0.7
gmpy2 2.0.8
google-auth 1.31.0
google-auth-oauthlib 0.4.4
google-pasta 0.2.0
greenlet 1.1.0
grpcio 1.34.1
h5py 3.1.0
HeapDict 1.0.1
html5lib 1.1
hydra-core 1.1.0
idna 2.10
image-classifiers 1.0.0
imageio 2.9.0
imagesize 1.2.0
importlib-metadata 3.10.0
importlib-resources 5.1.4
ImSegm 0.1.8
inflection 0.5.1
iniconfig 1.1.1
intervaltree 3.1.0
iopath 0.1.8
ipykernel 5.3.4
ipython 7.22.0
ipython-genutils 0.2.0
ipywidgets 7.6.3
isort 5.9.1
itsdangerous 2.0.1
jdcal 1.4.1
jedi 0.17.2
jeepney 0.6.0
Jinja2 2.11.3
jinja2-time 0.2.0
joblib 1.0.1
json5 0.9.6
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 6.1.12
jupyter-console 6.4.0
jupyter-core 4.7.1
jupyter-packaging 0.7.12
jupyter-server 1.4.1
jupyterlab 3.0.14
jupyterlab-pygments 0.1.2
jupyterlab-server 2.4.0
jupyterlab-widgets 1.0.0
Keras 2.3.1
Keras-Applications 1.0.8
keras-nightly 2.5.0.dev2021032900
Keras-Preprocessing 1.1.2
keyring 23.0.1
kiwisolver 1.3.1
lazy-object-proxy 1.6.0
libarchive-c 2.9
llvmlite 0.36.0
locket 0.2.1
lxml 4.6.3
Markdown 3.3.4
MarkupSafe 1.1.1
matplotlib 3.4.2
mccabe 0.6.1
mistune 0.8.4
mkl-fft 1.3.0
mkl-random 1.2.1
mkl-service 2.3.0
mock 4.0.3
more-itertools 8.8.0
mpmath 1.2.1
msgpack 1.0.2
multipledispatch 0.6.0
mypy-extensions 0.4.3
navigator-updater 0.2.1
nbclassic 0.2.6
nbclient 0.5.3
nbconvert 6.1.0
nbformat 5.1.3
nest-asyncio 1.5.1
networkx 2.5.1
nibabel 3.2.1
nltk 3.6.2
nose 1.3.7
notebook 6.4.0
np-utils 0.5.12.1
numba 0.53.1
numexpr 2.7.3
numpy 1.19.5
numpydoc 1.1.0
oauthlib 3.1.1
olefile 0.46
omegaconf 2.1.0
opencv-python 4.4.0.46
openpyxl 3.0.7
opt-einsum 3.3.0
packaging 20.9
pandas 1.1.4
pandocfilters 1.4.3
parso 0.7.0
partd 1.2.0
patchify 0.2.3
path 16.0.0
pathlib2 2.3.5
pathspec 0.8.1
pathtools 0.1.2
patsy 0.5.1
pbr 5.6.0
pep8 1.7.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 8.2.0
pip 21.1.2
pkginfo 1.7.0
planar 0.4
pluggy 0.13.1
ply 3.11
portalocker 2.3.0
poyo 0.5.0
prometheus-client 0.11.0
prompt-toolkit 3.0.17
protobuf 3.17.3
psutil 5.8.0
ptyprocess 0.7.0
py 1.10.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycocotools 2.0.2
pycodestyle 2.6.0
pycosat 0.6.3
pycparser 2.20
pycurl 7.43.0.6
pydocstyle 6.1.1
pydot 1.4.2
pyerfa 2.0.0
pyflakes 2.2.0
Pygments 2.9.0
pylint 2.8.3
pyls-black 0.4.6
pyls-spyder 0.3.2
pyodbc 4.0.0-unsupported
pyOpenSSL 20.0.1
pyparsing 2.4.7
pyrsistent 0.17.3
PySocks 1.7.1
pytest 6.2.4
python-dateutil 2.8.1
python-jsonrpc-server 0.4.0
python-language-server 0.36.2
python-slugify 5.0.2
pytz 2021.1
PyWavelets 1.1.1
pyxdg 0.27
PyYAML 5.4.1
pyzmq 20.0.0
QDarkStyle 3.0.2
qstylizer 0.1.10
QtAwesome 1.0.2
qtconsole 5.1.0
QtPy 1.9.0
regex 2021.4.4
requests 2.25.1
requests-oauthlib 1.3.0
rope 0.19.0
rsa 4.7.2
Rtree 0.9.7
ruamel-yaml-conda 0.15.100
scikit-image 0.18.1
scikit-learn 0.24.2
scipy 1.5.4
seaborn 0.11.1
SecretStorage 3.3.1
segmentation-models 1.0.1
Send2Trash 1.5.0
setuptools 57.0.0
simplegeneric 0.8.1
singledispatch 0.0.0
sip 4.19.13
six 1.15.0
sniffio 1.2.0
snowballstemmer 2.1.0
sortedcollections 2.1.0
sortedcontainers 2.4.0
soupsieve 2.2.1
Sphinx 4.0.2
sphinxcontrib-applehelp 1.0.2
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 2.0.0
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.5
sphinxcontrib-websupport 1.2.4
spyder 5.0.3
spyder-kernels 2.0.3
SQLAlchemy 1.4.19
statsmodels 0.12.2
sympy 1.8
tables 3.6.1
tabulate 0.8.9
tblib 1.7.0
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorflow 2.5.0
tensorflow-estimator 2.5.0
tensorflow-gpu 2.5.0
termcolor 1.1.0
terminado 0.9.4
testpath 0.5.0
testresources 2.0.1
text-unidecode 1.3
textdistance 4.2.1
threadpoolctl 2.1.0
three-merge 0.1.1
tifffile 2021.6.6
tinycss 0.4
toml 0.10.2
toolz 0.11.1
torch 1.6.0+cu101
torchvision 0.7.0+cu101
tornado 6.1
tqdm 4.51.0
traitlets 5.0.5
typed-ast 1.4.2
typing-extensions 3.7.4.3
ujson 4.0.2
unicodecsv 0.14.1
Unidecode 1.2.0
urllib3 1.26.5
watchdog 1.0.2
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 2.0.1
wheel 0.36.2
whichcraft 0.6.1
widgetsnbextension 3.5.1
wrapt 1.12.1
wurlitzer 2.1.0
xlrd 2.0.1
XlsxWriter 1.3.8
xlwt 1.3.0
xmltodict 0.12.0
yacs 0.1.8
yapf 0.31.0
zict 2.0.0
zipp 3.4.1
zope.event 4.5.0
zope.interface 5.3.0
Note: you may need to restart the kernel to use updated packages.
I have solved my issue by adding tf.compat.v1.enable_eager_execution() to import and it works fine
import tensorflow as tf
from tensorflow import keras
tf.compat.v1.enable_eager_execution()
import segmentation_models as sm
import glob
import cv2
import os
import numpy as np
from matplotlib import pyplot as plt
#import keras
from tensorflow.keras.utils import normalize
from tensorflow.keras.metrics import MeanIoU

How to store result of pip command into Pandas Datafarme

For getting the list of installed libraries, I run the following command in Jupyter Notebook:
!pip list
and I get the following as output:
Package Version
---------------------------------- ---------
alabaster 0.7.12
altair 4.1.0
anaconda-client 1.7.2
anaconda-navigator 1.9.7
anaconda-project 0.8.3
asn1crypto 0.24.0
astroid 2.2.5
astropy 3.2.1
atomicwrites 1.3.0
attrs 20.3.0
alabaster 0.7.12
altair 4.1.0
anaconda-client 1.7.2
anaconda-navigator 1.9.7
anaconda-project 0.8.3
asn1crypto 0.24.0
astroid 2.2.5
astropy 3.2.1
atomicwrites 1.3.0
attrs 20.3.0
Automat 20.2.0
azureml 0.2.7
Babel 2.7.0
backcall 0.1.0
backports.functools-lru-cache 1.5
backports.os 0.1.1
backports.shutil-get-terminal-size 1.0.0
backports.tempfile 1.0
backports.weakref 1.0.post1
beautifulsoup4 4.7.1
bitarray 0.9.3
bkcharts 0.2
bleach 3.1.0
bokeh 1.2.0
boto 2.49.0
boto3 1.14.61
botocore 1.17.61
Bottleneck 1.2.1
branca 0.4.1
category-encoders 2.2.2
certifi 2019.6.16
cffi 1.12.3
chardet 3.0.4
Click 7.0
click-spinner 0.1.10
cloudpickle 1.2.1
clyent 1.2.2
colorama 0.4.1
colorlog 4.2.1
comtypes 1.1.7
conda 4.7.10
conda-build 3.18.8
conda-package-handling 1.3.11
conda-verify 3.4.2
configparser 5.0.1
constantly 15.1.0
contextlib2 0.5.5
coverage 5.3
coveralls 2.1.2
cryptography 2.7
cycler 0.10.0
Cython 0.29.14
cytoolz 0.10.0
dacite 1.5.1
dask 2.1.0
decorator 4.4.0
defusedxml 0.6.0
distributed 2.1.0
docopt 0.6.2
docutils 0.14
entrypoints 0.3
et-xmlfile 1.0.1
fastcache 1.1.0
feature-engine 0.6.1
filelock 3.0.12
Flask 1.1.1
flit-core 2.3.0
folium 0.11.0
furl 2.1.0
future 0.17.1
gensim 3.8.3
genson 1.2.2
gevent 1.4.0
glob2 0.7
greenlet 0.4.15
h5py 2.9.0
heapdict 1.0.0
html5lib 1.0.1
hyperlink 20.0.1
hypothesis 5.41.2
idna 2.8
imageio 2.5.0
imagesize 1.1.0
imbalanced-learn 0.7.0
importlib-metadata 0.17
incremental 17.5.0
ipykernel 5.1.1
ipython 7.6.1
ipython-genutils 0.2.0
ipywidgets 7.5.0
isort 4.3.21
itsdangerous 1.1.0
jdcal 1.4.1
jedi 0.13.3
Jinja2 2.11.2
jmespath 0.10.0
joblib 0.13.2
json5 0.8.4
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 5.3.1
jupyter-console 6.0.0
jupyter-core 4.5.0
jupyterlab 1.0.2
jupyterlab-server 1.0.0
keyring 18.0.0
kiwisolver 1.1.0
lazy-object-proxy 1.4.1
libarchive-c 2.8
llvmlite 0.29.0
locket 0.2.0
lxml 4.5.2
MarkupSafe 1.1.1
matplotlib 3.1.0
mccabe 0.6.1
menuinst 1.4.16
mistune 0.8.4
mkl-fft 1.0.12
mkl-random 1.0.2
mkl-service 2.0.2
mock 3.0.5
more-itertools 7.0.0
mpmath 1.1.0
msgpack 0.6.1
multipledispatch 0.6.0
munch 2.5.0
navigator-updater 0.2.1
nbconvert 5.6.1
nbformat 4.4.0
networkx 2.3
nibabel 3.1.1
nltk 3.4.4
nose 1.3.7
notebook 6.0.0
numba 0.44.1
numexpr 2.6.9
numpy 1.19.2
numpydoc 0.9.1
olefile 0.46
openpyxl 2.6.2
orderedmultidict 1.0.1
packaging 20.4
pandas 1.1.3
pandocfilters 1.4.2
parso 0.5.0
partd 1.0.0
path.py 12.0.1
pathlib2 2.3.4
patsy 0.5.1
pep517 0.8.2
pep8 1.7.1
pickleshare 0.7.5
Pillow 6.1.0
pip 20.2.4
pkginfo 1.5.0.1
plotly 4.9.0
pluggy 0.12.0
ply 3.11
pmdarima 1.7.1
prometheus-client 0.7.1
prompt-toolkit 2.0.9
psutil 5.6.3
psycopg2 2.8.6
py 1.8.0
pycodestyle 2.5.0
pycosat 0.6.3
pycparser 2.19
pycrypto 2.6.1
pycurl 7.43.0.3
pyflakes 2.1.1
Pygments 2.4.2
PyHamcrest 2.0.2
pylint 2.3.1
pyodbc 4.0.26
pyOpenSSL 19.0.0
pyparsing 2.4.0
pyreadline 2.1
pyrsistent 0.14.11
PySocks 1.7.0
pytest 5.0.1
pytest-arraydiff 0.3
pytest-astropy 0.5.0
pytest-cov 2.10.1
pytest-doctestplus 0.3.0
pytest-openfiles 0.3.2
pytest-remotedata 0.3.1
python-dateutil 2.8.0
pytoml 0.1.21
pytz 2019.1
PyWavelets 1.0.3
pywin32 223
pywinpty 0.5.5
PyYAML 5.3.1
pyzmq 18.0.0
QtAwesome 0.5.7
qtconsole 4.5.1
QtPy 1.8.0
requests 2.22.0
requests-toolbelt 0.9.1
retrying 1.3.3
rope 0.14.0
ruamel-yaml 0.15.46
ruamel.yaml 0.16.12
ruamel.yaml.clib 0.2.2
s3transfer 0.3.3
scikit-image 0.15.0
scikit-learn 0.23.2
scipy 1.5.3
seaborn 0.10.1
Send2Trash 1.5.0
setuptools 41.0.1
simplegeneric 0.8.1
simplejson 3.17.2
singledispatch 3.4.0.3
six 1.12.0
sklearn 0.0
smart-open 2.1.1
snowballstemmer 1.9.0
sortedcollections 1.1.2
sortedcontainers 2.1.0
soupsieve 1.8
Sphinx 2.1.2
sphinxcontrib-applehelp 1.0.1
sphinxcontrib-devhelp 1.0.1
sphinxcontrib-htmlhelp 1.0.2
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.2
sphinxcontrib-serializinghtml 1.1.3
sphinxcontrib-websupport 1.1.2
spyder 3.3.6
spyder-kernels 0.5.1
SQLAlchemy 1.3.5
statsmodels 0.11.1
stumpy 1.5.0
sympy 1.4
tables 3.5.2
tabpy 2.3.1
tabulate 0.8.7
tblib 1.4.0
terminado 0.8.2
testpath 0.4.2
textblob 0.15.3
threadpoolctl 2.1.0
toml 0.10.1
toolz 0.10.0
tornado 6.0.3
tqdm 4.32.1
traitlets 4.3.2
Twisted 20.3.0
unicodecsv 0.14.1
urllib3 1.24.2
validators 0.16.0
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.15.4
wheel 0.33.4
widgetsnbextension 3.5.0
win-inet-pton 1.1.0
win-unicode-console 0.5
wincertstore 0.2
wrapt 1.11.2
xlrd 1.2.0
XlsxWriter 1.1.8
xlwings 0.15.8
xlwt 1.3.0
zict 1.0.0
zipp 0.5.1
zope.interface 5.2.0
How to store this result into a Pandas Dataframe? Just copying the data and pasting in two lists would do the job, but is there any code-based alternative to achieve this? In short, how to store the result of pip command into a Pandas Dataframe?
P.S: I referred here but was not of any help.
We can use os module to create the pip list, then we use pandas.read_csv with \s+ as seperator to read the pip list into a dataframe:
import os
import pandas as pd
# create pip list txt
os.system('pip list > pip_list.txt')
# read content into pandas df
df = pd.read_csv('pip_list.txt', sep=r'\s+', skiprows=[1])
# clean up
os.remove('pip_list.txt')
Package Version
0 appnope 0.1.0
1 argon2-cffi 20.1.0
2 astroid 2.4.2
3 async-generator 1.10
4 attrs 20.2.0
.. ... ...
100 urllib3 1.25.10
101 wcwidth 0.2.5
102 webencodings 0.5.1
103 wrapt 1.12.1
104 xlrd 1.2.0
[105 rows x 2 columns]
You can use subprocess to get the result in memory instead of creating a new file.
import subprocess
from io import StringIO
command = "pip list"
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
pd.read_csv(StringIO(output.decode("utf-8")), sep=r"\s*", skiprows=[1])

Why do I get O365 module not found error?

I wanted to get Outlook calendar data but the module is not recognized, constantly giving the following error:
ModuleNotFoundError: No module named 'O365'
Right from the first line (from O365 import Account) I can't get through.
After that, I've tried other packages but Visual Code Studio doesn't recognize any of them.
I installed all the packages and modules (after py -m pip list):
Package Version
---------------------------------- -------------------
alabaster 0.7.12
anaconda-client 1.7.2
anaconda-navigator 1.9.12
anaconda-project 0.8.3
argh 0.26.2
asn1crypto 1.3.0
astroid 2.4.2
astropy 4.0.1.post1
atomicwrites 1.4.0
attrs 19.3.0
autopep8 1.5.3
Babel 2.8.0
backcall 0.2.0
backports.functools-lru-cache 1.6.1
backports.shutil-get-terminal-size 1.0.0
backports.tempfile 1.0
backports.weakref 1.0.post1
bcrypt 3.1.7
beautifulsoup4 4.9.1
bitarray 1.4.0
bkcharts 0.2
bleach 3.1.5
bokeh 2.1.1
boto 2.49.0
Bottleneck 1.3.2
brotlipy 0.7.0
certifi 2020.6.20
cffi 1.14.0
chardet 3.0.4
click 7.1.2
cloudpickle 1.5.0
clyent 1.2.2
colorama 0.4.3
comtypes 1.1.7
conda 4.8.3
conda-build 3.18.11
conda-package-handling 1.7.0
conda-verify 3.4.2
contextlib2 0.6.0.post1
cryptography 2.9.2
cycler 0.10.0
Cython 0.29.21
cytoolz 0.10.1
dask 2.20.0
decorator 4.4.2
defusedxml 0.6.0
diff-match-patch 20200713
distributed 2.20.0
docutils 0.16
entrypoints 0.3
et-xmlfile 1.0.1
fastcache 1.1.0
filelock 3.0.12
flake8 3.8.3
Flask 1.1.2
fsspec 0.7.4
future 0.18.2
gevent 20.6.2
glob2 0.7
gmpy2 2.0.8
greenlet 0.4.16
h5py 2.10.0
HeapDict 1.0.1
html5lib 1.1
idna 2.10
imageio 2.9.0
imagesize 1.2.0
importlib-metadata 1.7.0
intervaltree 3.0.2
ipykernel 5.3.2
ipython 7.16.1
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 5.5.2
itsdangerous 1.1.0
jdcal 1.4.1
jedi 0.17.1
Jinja2 2.11.2
joblib 0.16.0
json5 0.9.5
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 6.1.6
jupyter-console 6.1.0
jupyter-core 4.6.3
jupyterlab 2.1.5
jupyterlab-server 1.2.0
keyring 21.2.1
kiwisolver 1.2.0
lazy-object-proxy 1.4.3
libarchive-c 2.9
llvmlite 0.33.0+1.g022ab0f
locket 0.2.0
lxml 4.5.2
MarkupSafe 1.1.1
matplotlib 3.2.2
mccabe 0.6.1
menuinst 1.4.16
mistune 0.8.4
mkl-fft 1.1.0
mkl-random 1.1.1
mkl-service 2.3.0
mock 4.0.2
more-itertools 8.4.0
mpmath 1.1.0
msgpack 1.0.0
multipledispatch 0.6.0
navigator-updater 0.2.1
nbconvert 5.6.1
nbformat 5.0.7
networkx 2.4
nltk 3.5
nose 1.3.7
notebook 6.0.3
numba 0.50.1
numexpr 2.7.1
numpy 1.18.5
numpydoc 1.1.0
O365 2.0.11
oauthlib 3.1.0
olefile 0.46
openpyxl 3.0.4
packaging 20.4
pandas 1.0.5
pandocfilters 1.4.2
paramiko 2.7.1
parso 0.7.0
partd 1.1.0
path 13.1.0
pathlib2 2.3.5
pathtools 0.1.2
patsy 0.5.1
pep8 1.7.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 7.2.0
pip 20.1.1
pkginfo 1.5.0.1
pluggy 0.13.1
ply 3.11
prometheus-client 0.8.0
prompt-toolkit 3.0.5
psutil 5.7.0
py 1.9.0
pycodestyle 2.6.0
pycosat 0.6.3
pycparser 2.20
pycurl 7.43.0.5
pydocstyle 5.0.2
pyflakes 2.2.0
Pygments 2.6.1
pylint 2.6.0
PyNaCl 1.4.0
pyodbc 4.0.0-unsupported
pyOpenSSL 19.1.0
pyparsing 2.4.7
pyreadline 2.1
pyrsistent 0.16.0
PySocks 1.7.1
pytest 5.4.3
python-dateutil 2.8.1
python-jsonrpc-server 0.3.4
python-language-server 0.34.1
pytz 2020.1
PyWavelets 1.1.1
pywin32 227
pywin32-ctypes 0.2.0
pywinpty 0.5.7
PyYAML 5.3.1
pyzmq 19.0.1
QDarkStyle 2.8.1
QtAwesome 0.7.2
qtconsole 4.7.5
QtPy 1.9.0
regex 2020.6.8
requests 2.24.0
requests-oauthlib 1.3.0
rope 0.17.0
Rtree 0.9.4
ruamel-yaml 0.15.87
scikit-image 0.16.2
scikit-learn 0.23.1
scipy 1.5.0
seaborn 0.10.1
Send2Trash 1.5.0
setuptools 49.2.0.post20200714
simplegeneric 0.8.1
singledispatch 3.4.0.3
sip 4.19.13
six 1.15.0
snowballstemmer 2.0.0
sortedcollections 1.2.1
sortedcontainers 2.2.2
soupsieve 2.0.1
Sphinx 3.1.2
sphinxcontrib-applehelp 1.0.2
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 1.0.3
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.4
sphinxcontrib-websupport 1.2.3
spyder 4.1.4
spyder-kernels 1.9.2
SQLAlchemy 1.3.18
statsmodels 0.11.1
stringcase 1.2.0
sympy 1.6.1
tables 3.6.1
tblib 1.6.0
terminado 0.8.3
testpath 0.4.4
threadpoolctl 2.1.0
toml 0.10.1
toolz 0.10.0
tornado 6.0.4
tqdm 4.47.0
traitlets 4.3.3
typing-extensions 3.7.4.2
tzlocal 2.1
ujson 1.35
unicodecsv 0.14.1
urllib3 1.25.9
watchdog 0.10.3
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 1.0.1
wheel 0.34.2
widgetsnbextension 3.5.1
win-inet-pton 1.1.0
win-unicode-console 0.5
wincertstore 0.2
wrapt 1.12.1
xlrd 1.2.0
XlsxWriter 1.2.9
xlwings 0.19.5
xlwt 1.3.0
xmltodict 0.12.0
yapf 0.30.0
zict 2.0.0
zipp 3.1.0
zope.event 4.4
zope.interface 4.7.1
As seen above, the O365 module is also there.
UPDATE:
After changing interpreter, the problem above is solved but now we encountered another one:
ImportError: cannot import name 'Account' from partially initialized module 'O365' (most likely due to a circular import)
I'd appreciate any help, thanks!
You might want to check if the version of Python Visual Studio Code uses is the version on which you have installed O365
You can change your python interpreter by opening the command palate f1 and type Python: Select Interpreter
Answer to the updated question:
It says you have most likely a circular import.
O365 depends on the following packages:
requests
requests-oauthlib
beatifulsoup4
stringcase
python-dateutil
tzlocal
pytz
If you have any import statements using one of the packages above, deleting the import statement might fix your error.

Categories

Resources