IDLE and Teminal unable to import an installed module - python-3.x

I've been trying to import discord.py into my code for quite some time now and it hasn't been working even though it is definitely installed, none of the fixing methods from other similar questions worked either.
Terminal and IDLE unable to import discord.py
Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import discord.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'discord.py'
>>>
MacBook-Pro:~ pyaesonemyo$ python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import discord.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named discord.py
Proof that discord.py is installed
MacBook-Pro:~ pyaesonemyo$ pip install discord.py
Requirement already satisfied: discord.py in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.3.3)
Requirement already satisfied: websockets!=7.0,!=8.0,!=8.0.1,<9.0,>=6.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from discord.py) (8.1)
Requirement already satisfied: aiohttp<3.7.0,>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from discord.py) (3.6.2)
Requirement already satisfied: multidict<5.0,>=4.5 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (4.7.6)
Requirement already satisfied: attrs>=17.3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (19.3.0)
Requirement already satisfied: yarl<2.0,>=1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (1.4.2)
Requirement already satisfied: chardet<4.0,>=2.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (3.0.4)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (3.0.1)
Requirement already satisfied: idna>=2.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from yarl<2.0,>=1.0->aiohttp<3.7.0,>=3.6.0->discord.py) (2.9)
MacBook-Pro:~ pyaesonemyo$ pip show discord.py
Name: discord.py
Version: 1.3.3
Summary: A Python wrapper for the Discord API
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email: None
License: MIT
Location: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
Requires: websockets, aiohttp
Required-by:
MacBook-Pro:~ pyaesonemyo$
My sys.path:
MacBook-Pro:~ pyaesonemyo$ python3
Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages']
>>>
I've also tried out multiple popular fixes and still failed.
MacBook-Pro:~ pyaesonemyo$ sudo chmod -R ugo+rX /lib/python3.8/site-packages/
chmod: /lib/python3.8/site-packages/: No such file or directory
MacBook-Pro:~ pyaesonemyo$ python3 -m pip install discord.py
Requirement already satisfied: discord.py in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.3.3)
Requirement already satisfied: aiohttp<3.7.0,>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from discord.py) (3.6.2)
Requirement already satisfied: websockets!=7.0,!=8.0,!=8.0.1,<9.0,>=6.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from discord.py) (8.1)
Requirement already satisfied: chardet<4.0,>=2.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (3.0.4)
Requirement already satisfied: attrs>=17.3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (19.3.0)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (3.0.1)
Requirement already satisfied: yarl<2.0,>=1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (1.4.2)
Requirement already satisfied: multidict<5.0,>=4.5 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (4.7.6)
Requirement already satisfied: idna>=2.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from yarl<2.0,>=1.0->aiohttp<3.7.0,>=3.6.0->discord.py) (2.9)
NOTE: Using python -m pip install <package> without python3 gives out this error
MacBook-Pro:~ pyaesonemyo$ python -m pip install discord.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting discord.py
Using cached discord.py-0.16.12.tar.gz (414 kB)
Collecting aiohttp<1.1.0,>=1.0.0
Using cached aiohttp-1.0.5.tar.gz (499 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tk/mbdd48gd5614t0l0j0xztrdr0000gn/T/pip-install-mbx8EX/aiohttp/setup.py'"'"'; __file__='"'"'/private/var/folders/tk/mbdd48gd5614t0l0j0xztrdr0000gn/T/pip-install-mbx8EX/aiohttp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/tk/mbdd48gd5614t0l0j0xztrdr0000gn/T/pip-pip-egg-info-3n4ucd
cwd: /private/var/folders/tk/mbdd48gd5614t0l0j0xztrdr0000gn/T/pip-install-mbx8EX/aiohttp/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/tk/mbdd48gd5614t0l0j0xztrdr0000gn/T/pip-install-mbx8EX/aiohttp/setup.py", line 60, in <module>
raise RuntimeError("aiohttp requires Python 3.4.2+")
RuntimeError: aiohttp requires Python 3.4.2+
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

You are installing Discord.py to Python 2.7 but you're trying to use it in Python 3

I was actually being very dumb by adding the .py extension in the importing code.
remove the .py from
import discord.py
will fix it as suggested by #jadz

Related

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

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

steps to install spacy (anaconda) package along with dependencies without internet for python 3.6.5 for prod server?

Can anyone help in providing the steps to install Spacy package? I am facing a lot of difficulties in setting it up without an internet connection. Facing a lot of errors. Steps would be really helpful.
As of now I manually downloaded the dependencies (whl files) and installed. Spacy package is also successfully installed. But when I tried to import I am facing the problem.
(base) C:\Windows\system32>pip install E:/PythonPacakges/spacy-2.0.16-cp36-cp36m-win_amd64.whl
Requirement already satisfied: spacy==2.0.16 from file:///E:/PythonPacakges/spacy-2.0.16-cp36-cp36m-win_amd64.whl in d:\programdata\anaconda3\lib\site-packages (2.0.16)
Requirement already satisfied: preshed>=2.0.1 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (2.0.1)
Requirement already satisfied: plac>=0.9.6 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (0.9.6)
Requirement already satisfied: dill>=0.2 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (0.2.8.2)
Requirement already satisfied: msgpack-numpy in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (0.4.4.2)
Requirement already satisfied: cymem>=2.0.2 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (2.0.2)
Requirement already satisfied: regex>=2018.01.10 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (2018.11.22)
Requirement already satisfied: requests>=2.13.0 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (2.18.4)
Requirement already satisfied: numpy in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (1.14.3)
Requirement already satisfied: murmurhash>=0.28.0 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (1.0.1)
Requirement already satisfied: thinc>=6.12.0 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (6.12.0)
Requirement already satisfied: ujson>=1.35 in d:\programdata\anaconda3\lib\site-packages (from spacy==2.0.16) (1.35)
Requirement already satisfied: msgpack>=0.5.2 in d:\programdata\anaconda3\lib\site-packages (from msgpack-numpy->spacy==2.0.16) (0.5.6)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in d:\programdata\anaconda3\lib\site-packages (from requests>=2.13.0->spacy==2.0.16) (3.0.4)
Requirement already satisfied: idna<2.7,>=2.5 in d:\programdata\anaconda3\lib\site-packages (from requests>=2.13.0->spacy==2.0.16) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in d:\programdata\anaconda3\lib\site-packages (from requests>=2.13.0->spacy==2.0.16) (1.22)
Requirement already satisfied: certifi>=2017.4.17 in d:\programdata\anaconda3\lib\site-packages (from requests>=2.13.0->spacy==2.0.16) (2018.4.16)
Requirement already satisfied: cytoolz>=0.9.0 in d:\programdata\anaconda3\lib\site-packages (from thinc>=6.12.0->spacy==2.0.16) (0.9.0.1)
Requirement already satisfied: tqdm>=4.10.0 in d:\programdata\anaconda3\lib\site-packages (from thinc>=6.12.0->spacy==2.0.16) (4.28.1)
Requirement already satisfied: six>=1.10.0 in d:\programdata\anaconda3\lib\site-packages (from thinc>=6.12.0->spacy==2.0.16) (1.11.0)
Requirement already satisfied: wrapt>=1.10.0 in d:\programdata\anaconda3\lib\site-packages (from thinc>=6.12.0->spacy==2.0.16) (1.10.11)
Requirement already satisfied: toolz>=0.8.0 in d:\programdata\anaconda3\lib\site-packages (from cytoolz>=0.9.0->thinc>=6.12.0->spacy==2.0.16) (0.9.0)
(base) C:\Windows\system32>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\ProgramData\Anaconda3\lib\site-packages\spacy\__init__.py", line 8, in <module>
from thinc.neural.util import prefer_gpu, require_gpu
File "D:\ProgramData\Anaconda3\lib\site-packages\thinc\neural\__init__.py", line 1, in <module>
from ._classes.model import Model
File "D:\ProgramData\Anaconda3\lib\site-packages\thinc\neural\_classes\model.py", line 11, in <module>
from .. import util
File "D:\ProgramData\Anaconda3\lib\site-packages\thinc\neural\util.py", line 3, in <module>
from preshed.maps import PreshMap
File "cymem.pxd", line 1, in init preshed.maps
ValueError: cymem.cymem.Pool has the wrong size, try recompiling. Expected 64, got 48
>>>
So I went through the same, fixed it uninstalling all spacy related packages and files then reinstalling it to version 2.0.13. You can do this by-
pip install spacy ==2.0.13
For conda i suppose doing the same with 'conda install spacy ==2.0.13' should also work.
Edit - You can do this without uninstalling spacy aswell

cannot start pgadmin4 python app

I am missing something, I have downloaded pgadmin4 webapp, and trying to launch it in its environnement:
(pgadmin) denis ~/anaconda3/envs/pgadmin/lib/python3.5/site-packages/pgadmin4 $ pip install flask_babel
Requirement already satisfied: flask_babel in /home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages
Requirement already satisfied: Jinja2>=2.5 in /home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages (from flask_babel)
Requirement already satisfied: Babel>=2.3 in /home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages (from flask_babel)
Requirement already satisfied: Flask in /home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages (from flask_babel)
Requirement already satisfied: markupsafe in /home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages (from Jinja2>=2.5->flask_babel)
Requirement already satisfied: pytz>=0a in /home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages (from Babel>=2.3->flask_babel)
Requirement already satisfied: itsdangerous>=0.21 in /home/denis/.local/lib/python3.5/site-packages (from Flask->flask_babel)
Requirement already satisfied: Werkzeug>=0.7 in /home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages (from Flask->flask_babel)
(pgadmin) denis ~/anaconda3/envs/pgadmin/lib/python3.5/site-packages/pgadmin4 $ sudo python pgAdmin4.py
Traceback (most recent call last):
File "pgAdmin4.py", line 34, in <module>
import config
File "/home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages/pgadmin4/config.py", line 30, in <module>
from pgadmin.utils import env, IS_PY2, IS_WIN, fs_short_path
File "/home/denis/anaconda3/envs/pgadmin/lib/python3.5/site-packages/pgadmin4/pgadmin/__init__.py", line 18, in <module>
from flask_babel import Babel, gettext
ImportError: No module named flask_babel
What can I do more than source activate pgadmin and install all requirements.txt?
Running sudo python doesnt use your virtualenv. Install pgadmin reqs globally or drop sudo.

How to install pybel in conda enviorment?

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

Resources