How to install pybel in conda enviorment? - python-3.x

I tried to install pybel in conda, but it doesn't really work, even though the installation looks ok, all the module's API function aren't present.
me$ conda create --name py34 python=3.4
Fetching package metadata .................
Solving package specifications: .
Package plan for installation in environment /Users/me/anaconda3/envs/py34:
The following NEW packages will be INSTALLED:
ca-certificates: 2018.1.18-0 conda-forge
certifi: 2017.1.23-py34_0 conda-forge
ncurses: 5.9-10 conda-forge
openssl: 1.0.2n-0 conda-forge
pip: 9.0.1-py34_0 conda-forge
python: 3.4.5-2 conda-forge
readline: 6.2-0 conda-forge
setuptools: 32.3.1-py34_0 conda-forge
sqlite: 3.13.0-1 conda-forge
tk: 8.5.19-2 conda-forge
wheel: 0.29.0-py34_0 conda-forge
xz: 5.2.3-0 conda-forge
zlib: 1.2.11-0 conda-forge
Proceed ([y]/n)? y
#
# To activate this environment, use:
# > source activate py34
#
# To deactivate an active environment, use:
# > source deactivate
#
Activated the enviorment:
me$ source activate py34
(py34) iMac:me$ pip install pybel
Collecting pybel
Using cached PyBEL-0.11.0-py2.py3-none-any.whl
Collecting click (from pybel)
Using cached click-6.7-py2.py3-none-any.whl
Collecting pyparsing (from pybel)
Using cached pyparsing-2.2.0-py2.py3-none-any.whl
Collecting six (from pybel)
Using cached six-1.11.0-py2.py3-none-any.whl
Collecting sqlalchemy==1.1.15 (from pybel)
Collecting requests-file (from pybel)
Using cached requests_file-1.4.3-py2.py3-none-any.whl
Collecting requests (from pybel)
Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting networkx==1.11 (from pybel)
Using cached networkx-1.11-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->pybel)
Using cached certifi-2018.1.18-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->pybel)
Using cached idna-2.6-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests->pybel)
Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->pybel)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting decorator>=3.4.0 (from networkx==1.11->pybel)
Using cached decorator-4.2.1-py2.py3-none-any.whl
Installing collected packages: click, pyparsing, six, sqlalchemy, certifi, idna, urllib3, chardet, requests, requests-file, decorator, networkx, pybel
Found existing installation: certifi 2017.1.23
DEPRECATION: Uninstalling a distutils installed project (certifi) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling certifi-2017.1.23:
Successfully uninstalled certifi-2017.1.23
Successfully installed certifi-2018.1.18 chardet-3.0.4 click-6.7 decorator-4.2.1 idna-2.6 networkx-1.11 pybel-0.11.0 pyparsing-2.2.0 requests-2.18.4 requests-file-1.4.3 six-1.11.0 sqlalchemy-1.1.15 urllib3-1.22
(py34) iMac: me$ pip install pybel
Requirement already satisfied: pybel in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages
Requirement already satisfied: sqlalchemy==1.1.15 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
Requirement already satisfied: click in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
Requirement already satisfied: requests in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
Requirement already satisfied: six in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
Requirement already satisfied: networkx==1.11 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
Requirement already satisfied: requests-file in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
Requirement already satisfied: pyparsing in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
Requirement already satisfied: idna<2.7,>=2.5 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
Requirement already satisfied: certifi>=2017.4.17 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
Requirement already satisfied: decorator>=3.4.0 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from networkx==1.11->pybel)
Ran python prompt and tried to import pybel but it doesn't really have the API inside (for example readfile):
(py34) iMac: me$ python
Python 3.4.5 | packaged by conda-forge | (default, Sep 8 2016, 14:36:28)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybel
>>> dir(pybel)
['BELGraph', 'Manager', 'NDEX_SOURCE_FORMAT', 'NetworkManager', '__all__', '__author__', '__builtins__', '__cached__', '__copyright__', '__description__', '__doc__', '__email__', '__file__', '__license__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__title__', '__url__', '__version__', 'and_edge_predicates', 'build_annotation_dict_all_filter', 'build_annotation_dict_any_filter', 'cache_manager', 'canonicalize', 'concatenate_node_predicates', 'constants', 'count_functions', 'count_namespaces', 'count_passed_edge_filter', 'count_passed_node_filter', 'database_io', 'dsl', 'edge_has_activity', 'edge_has_annotation', 'edge_has_degradation', 'edge_has_translocation', 'edge_predicate', 'edge_to_bel', 'egf_graph', 'examples', 'exceptions', 'filter_edges', 'filter_nodes', 'from_biopax', 'from_bytes', 'from_cbn_jgif', 'from_cx', 'from_cx_file', 'from_cx_jsons', 'from_database', 'from_indra_pickle', 'from_indra_statements', 'from_jgif', 'from_json', 'from_json_file', 'from_jsons', 'from_lines', 'from_ndex', 'from_path', 'from_pickle', 'from_url', 'from_web', 'get_annotation_values_by_annotation', 'get_functions', 'get_names_by_namespace', 'get_namespaces', 'get_nodes', 'get_pubmed_identifiers', 'get_syntax_errors', 'get_unused_namespaces', 'has_activity', 'has_authors', 'has_causal_in_edges', 'has_causal_out_edges', 'has_fragment', 'has_gene_modification', 'has_hgvs', 'has_polarity', 'has_protein_modification', 'has_provenance', 'has_pubmed', 'has_variant', 'invert_edge_filter', 'io', 'is_abundance', 'is_associative_relation', 'is_causal_central', 'is_causal_relation', 'is_causal_sink', 'is_causal_source', 'is_degraded', 'is_direct_causal_relation', 'is_gene', 'is_pathology', 'is_protein', 'is_translocated', 'iter_annotation_value_pairs', 'iter_annotation_values', 'iterate_pubmed_identifiers', 'keep_node_permissive', 'language', 'left_full_join', 'left_node_intersection_join', 'left_outer_join', 'manager', 'node_exclusion_predicate_builder', 'node_inclusion_predicate_builder', 'node_intersection', 'node_to_bel', 'not_pathology', 'parser', 'resources', 'sialic_acid_graph', 'strip_annotations', 'struct', 'to_bel', 'to_bel_lines', 'to_bel_path', 'to_bytes', 'to_csv', 'to_cx', 'to_cx_file', 'to_cx_jsons', 'to_database', 'to_graphml', 'to_gsea', 'to_indra', 'to_jgif', 'to_json', 'to_json_file', 'to_jsons', 'to_ndex', 'to_neo4j', 'to_pickle', 'to_sif', 'to_web', 'tokens', 'union', 'utils']
>>> pybel.readfile("pdb","a.pdb")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'readfile'
>>>

If you are using Windows, you may use the below command:
python -m pip install pybel_tools
If you are using Linux:
sudo python3 -m pip install pybel_tools

Related

ERROR: No matching distribution found for typed-json-dataclass

Goal: install typed-json-dataclass in project venv.
Python 3.6.13
conda 4.11.0
Terminal:
(project) me#ubuntu-pcs:~/PycharmProjects/project$ pip install typed_json_dataclass
ERROR: Could not find a version that satisfies the requirement typed_json_dataclass (from versions: none)
ERROR: No matching distribution found for typed_json_dataclass
(project) me#ubuntu-pcs:~/PycharmProjects/project$ pip install typed-json-dataclass
ERROR: Could not find a version that satisfies the requirement typed-json-dataclass (from versions: none)
ERROR: No matching distribution found for typed-json-dataclass
requirements.txt:
typed_json_dataclass
typed_json_dataclass==1.2.1
typed_json_dataclass==1.2.*
Terminal:
(project) me#ubuntu-pcs:~/PycharmProjects/project$ pip install -r requirements.txt
ERROR: Could not find a version that satisfies the requirement typed_json_dataclass (from versions: none)
ERROR: No matching distribution found for typed_json_dataclass
(project) me#ubuntu-pcs:~/PycharmProjects/project$ pip install -r requirements.txt
ERROR: Could not find a version that satisfies the requirement typed_json_dataclass==1.2.1 (from versions: none)
ERROR: No matching distribution found for typed_json_dataclass==1.2.1
(project) me#ubuntu-pcs:~/PycharmProjects/project$ pip install -r requirements.txt
ERROR: Could not find a version that satisfies the requirement typed_json_dataclass==1.2.* (from versions: none)
ERROR: No matching distribution found for typed_json_dataclass==1.2.*
I can however install via. a separate project repo and venv:
Python 3.9.12
Terminal:
(project2) me#ubuntu-pcs:~/PycharmProjects/project2$ pip install typed_json_dataclass
Requirement already satisfied: typed_json_dataclass in /home/me/miniconda3/envs/project2/lib/python3.9/site-packages (1.2.1)
Requirement already satisfied: flake8-tuple<0.5.0,>=0.4.0 in /home/me/miniconda3/envs/project2/lib/python3.9/site-packages (from typed_json_dataclass) (0.4.1)
Requirement already satisfied: flake8 in /home/me/miniconda3/envs/project2/lib/python3.9/site-packages (from flake8-tuple<0.5.0,>=0.4.0->typed_json_dataclass) (4.0.1)
Requirement already satisfied: six in /home/me/miniconda3/envs/project2/lib/python3.9/site-packages (from flake8-tuple<0.5.0,>=0.4.0->typed_json_dataclass) (1.16.0)
Requirement already satisfied: pyflakes<2.5.0,>=2.4.0 in /home/me/miniconda3/envs/project2/lib/python3.9/site-packages (from flake8->flake8-tuple<0.5.0,>=0.4.0->typed_json_dataclass) (2.4.0)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /home/me/miniconda3/envs/project2/lib/python3.9/site-packages (from flake8->flake8-tuple<0.5.0,>=0.4.0->typed_json_dataclass) (0.6.1)
Requirement already satisfied: pycodestyle<2.9.0,>=2.8.0 in /home/me/miniconda3/envs/project2/lib/python3.9/site-packages (from flake8->flake8-tuple<0.5.0,>=0.4.0->typed_json_dataclass) (2.8.0)
See the pypi page of typed-json-dataclass under Meta:
Requires: Python >=3.7, <4.0
which is why pip cannot install it for your python 3.6
There is no way to get it to work with python 3.6, as its sole purpose is to expand the dataclass which was only added in python 3.7, so you will need to switch to a different python version (if possible)

Why pip does not install a package?

pip install indicates that the nitime package was successfully installed but it is not. Why is this?
$ pip3 install nitime
Defaulting to user installation because normal site-packages is not writeable
Collecting nitime
Using cached nitime-0.9.tar.gz (6.2 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./.local/lib/python3.8/site-packages (from nitime) (1.22.3)
Requirement already satisfied: cython in /usr/lib64/python3.8/site-packages (from nitime) (0.29.14)
Requirement already satisfied: scipy in ./.local/lib/python3.8/site-packages (from nitime) (1.8.0)
Requirement already satisfied: matplotlib in /usr/lib64/python3.8/site-packages (from nitime) (3.2.2)
Requirement already satisfied: networkx in /usr/lib/python3.8/site-packages (from nitime) (2.5)
Requirement already satisfied: nibabel in ./.local/lib/python3.8/site-packages (from nitime) (3.2.2)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python3.8/site-packages (from matplotlib->nitime) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/lib64/python3.8/site-packages (from matplotlib->nitime) (1.3.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python3.8/site-packages (from matplotlib->nitime) (2.4.7)
Requirement already satisfied: python-dateutil>=2.1 in ./.local/lib/python3.8/site-packages (from matplotlib->nitime) (2.8.2)
Requirement already satisfied: decorator>=4.3.0 in /usr/lib/python3.8/site-packages (from networkx->nitime) (4.4.0)
Requirement already satisfied: packaging>=14.3 in ./.local/lib/python3.8/site-packages (from nibabel->nitime) (21.3)
Requirement already satisfied: setuptools in ./.local/lib/python3.8/site-packages (from nibabel->nitime) (60.6.0)
Requirement already satisfied: six in /usr/lib/python3.8/site-packages (from cycler>=0.10->matplotlib->nitime) (1.14.0)
Using legacy 'setup.py install' for nitime, since package 'wheel' is not installed.
Installing collected packages: nitime
Running setup.py install for nitime ... done
Successfully installed nitime
$ pip3 show nitime
WARNING: Package(s) not found: nitime
$ python3 -c "import nitime"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'nitime'
$ pip3 show pip
Name: pip
Version: 22.0.4
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig#python.org
License: MIT
Location: /home/servoz/.local/lib/python3.8/site-packages
Requires:
Required-by:
$ uname -a
Linux 5.11.22-100.fc32.x86_64 #1 SMP Wed May 19 18:58:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ python3 -V
Python 3.8.10
EDIT:
Ok! I managed to install using dnf install python3-nitime (fedora).
I don't really understand why pip doesn't work with nitime on fedora ...
This may be because of conflicts with other packages, so try doing this in a new environment. Try creating a virtual environment. Install virtualenv using this:
pip install virtualenv
Create a virtual environment named venv using this:
virtualenv venv
To activate the virtual environment, use this:
source ./venv/bin/activate
Try installing nitime now:
pip3 install nitime
Done!
You can deactivate the virtual environment using this:
deactivate

pip in a (mini)conda environment installs packages in the global site-packages directory

As the answer to this question indicates, pip in a conda-env should install a package in the site-packages directory of env's python. In my case, however, pip (launched within the env) is trying to install in the global python site-packages.
Additionally, the installation in the site-packages of my global python is not so very clean either: newly installed packages fall under /Users/massimopinto/Library/Python/3.9/site-packages/Users/massimopinto/Library/Python/3.9/site-packages , that is the directory is nested within itself, so I need to manually move the new package to make it usable.
Would a re-configuration of pip work? Any advice would be much appreciated.
pip in use (21.2.4):
(spekpy) massimopinto#MacBook-Air-2 spekpy_release % which pip
/Users/massimopinto/opt/miniconda3/envs/spekpy/bin/pip
(env's) pip configuration:
(spekpy) massimopinto#MacBook-Air-2 spekpy_release % pip config list
freeze.timeout='10'
global.editor='vim'
global.timeout='60'
home's pip configuration:
(spekpy) massimopinto#MacBook-Air-2 spekpy_release % cat ~/.pip/pip.conf
[global]
timeout = 60
[freeze]
timeout = 10
running on a MacOS Monterey 12.0.1, conda 4.10.3, Python 3.9.7.
Edited
As at a suggestion by #flyingteller, the output of
/Users/massimopinto/opt/miniconda3/envs/spekpy/bin/python -m pip install . >> spekpy-install.log
is
Processing /Users/massimopinto/Progetti Git/spekpy_release
Requirement already satisfied: scipy in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from spekpy==2.0.6) (1.7.1)
Requirement already satisfied: matplotlib in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from spekpy==2.0.6) (3.4.3)
Requirement already satisfied: pyparsing>=2.2.1 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (3.0.4)
Requirement already satisfied: numpy>=1.16 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (1.21.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (1.3.1)
Requirement already satisfied: python-dateutil>=2.7 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (2.8.2)
Requirement already satisfied: cycler>=0.10 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (0.11.0)
Requirement already satisfied: pillow>=6.2.0 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from matplotlib->spekpy==2.0.6) (8.4.0)
Requirement already satisfied: six>=1.5 in /Users/massimopinto/opt/miniconda3/envs/spekpy/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib->spekpy==2.0.6) (1.16.0)
Building wheels for collected packages: spekpy
Building wheel for spekpy (setup.py): started
Building wheel for spekpy (setup.py): finished with status 'done'
Created wheel for spekpy: filename=spekpy-2.0.6-py3-none-any.whl size=66391250 sha256=86962e10ec6182d7f0522dcf0d3e1d264b9d16d3659d5d5af038631d99bd8039
Stored in directory: /private/var/folders/qs/hcv45zhn46q0p6xwndbc51fw0000gn/T/pip-ephem-wheel-cache-etx845ts/wheels/c3/93/d0/2db997ad51d9b10f0b0acac3a1f27240cca3d41a8cac3265ab
Successfully built spekpy
Installing collected packages: spekpy
Successfully installed spekpy-2.0.6
but the installation is still in
/Users/massimopinto/Library/Python/3.9/site-packages/Users/massimopinto/Library/Python/3.9/site-packages/spekpy

NOT able to import Folium after showing folium in conda list

I have installed folium using both pip and conda , it got successfully installed infact conda list in particular environment also showing still i can not be able to import the folium.
#Instructions i followed to installed folium are below:-
(ML) C:\Users\24HOURS>pip3 install folium
Requirement already satisfied: folium in c:\users\24hours\miniconda3\envs\ml\lib
\site-packages (0.10.1)
Requirement already satisfied: numpy in c:\users\24hours\miniconda3\envs\ml\lib\
site-packages (from folium) (1.19.2)
Requirement already satisfied: requests in c:\users\24hours\miniconda3\envs\ml\l
ib\site-packages (from folium) (2.25.1)
Requirement already satisfied: branca>=0.3.0 in c:\users\24hours\miniconda3\envs
\ml\lib\site-packages (from folium) (0.4.2)
Requirement already satisfied: jinja2>=2.9 in c:\users\24hours\miniconda3\envs\m
l\lib\site-packages (from folium) (2.11.3)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\24hours\miniconda3\e
nvs\ml\lib\site-packages (from jinja2>=2.9->folium) (1.1.1)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\24hours\miniconda3\
envs\ml\lib\site-packages (from requests->folium) (4.0.0)
Requirement already satisfied: idna<3,>=2.5 in c:\users\24hours\miniconda3\envs\
ml\lib\site-packages (from requests->folium) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\24hours\minicon
da3\envs\ml\lib\site-packages (from requests->folium) (1.26.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\24hours\miniconda3
\envs\ml\lib\site-packages (from requests->folium) (2020.12.5)
conda way installation below:-
(ML) C:\Users\24HOURS>conda install -c conda-forge folium
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.9.2
latest version: 4.10.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: C:\Users\24HOURS\miniconda3\envs\ML
added / updated specs:
- folium
The following packages will be UPDATED:
ca-certificates conda-forge/label/cf202003::ca-certif~ --> conda-forge::ca-
certificates-2020.12.5-h5b45459_0
folium conda-forge/label/cf202003::folium-0.~ --> conda-forge::fol
ium-0.12.0-pyhd8ed1ab_1
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(ML) C:\Users\24HOURS>
Still I am getting import Error for folium
In jupyter notebook
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-173c1173bf1c> in <module>
----> 1 import folium
ModuleNotFoundError: No module named 'folium'

Python3 import Error: No module named 'pytest'

I have installed pytest successfully,but import error occurs "ModuleNotFoundError: No module named 'pytest'".I can see pytest in my finder but it not in the "python3 -m pip list".How can I solve it?
HelendeMacBook-Pro:bin helendai$ pip3 install pytest
Collecting pytest
Using cached pytest-5.4.1-py3-none-any.whl (246 kB)
Requirement already satisfied: more-itertools>=4.0.0 in /usr/local/lib/python3.6/site-packages (from pytest) (8.2.0)
Requirement already satisfied: packaging in /usr/local/lib/python3.6/site-packages (from pytest) (20.3)
Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.6/site-packages (from pytest) (19.3.0)
Requirement already satisfied: pluggy<1.0,>=0.12 in /usr/local/lib/python3.6/site-packages (from pytest) (0.13.1)
Requirement already satisfied: py>=1.5.0 in /usr/local/lib/python3.6/site-packages (from pytest) (1.8.1)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.6/site-packages (from pytest) (0.1.9)
Requirement already satisfied: importlib-metadata>=0.12; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from pytest) (1.6.0)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.6/site-packages (from packaging->pytest) (2.4.7)
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from packaging->pytest) (1.14.0)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/site-packages (from importlib-metadata>=0.12; python_version < "3.8"->pytest) (3.1.0)
Installing collected packages: pytest
Successfully installed pytest-5.4.1
HelendeMacBook-Pro:bin helendai$ python3 -m pip list
Package Version
------------ ----------
certifi 2019.11.28
cffi 1.14.0
chardet 3.0.4
cryptography 2.8
idna 2.9
pip 20.0.2
pycparser 2.20
pyOpenSSL 19.1.0
PyYAML 5.3
requests 2.23.0
setuptools 41.2.0
six 1.14.0
urllib3 1.25.8
HelendeMacBook-Pro:bin helendai$ python3
Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pytest'
enter image description here
perhaps you had installed multiple python on your computer, because the install logs show pytest is installed on python 3.6, but the python shell show your python version is 3.8.2

Resources