cannot start pgadmin4 python app - python-3.x

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.

Related

Why I can't import Flask?

I followed the Flask instructions and I successfully installed Flask by using Command Prompt.
C:\Users\DELL>py -3 -m pip install flask
C:\Users\DELL>py -3 -m pip install flask
Requirement already satisfied: flask in c:\users\dell\appdata\local\programs\python\python39\lib\site-packages (1.1.2)
Requirement already satisfied: itsdangerous>=0.24 in c:\users\dell\appdata\local\programs\python\python39\lib\site-packages (from flask) (1.1.0)
Requirement already satisfied: Jinja2>=2.10.1 in c:\users\dell\appdata\local\programs\python\python39\lib\site-packages (from flask) (2.11.2)
Requirement already satisfied: Werkzeug>=0.15 in c:\users\dell\appdata\local\programs\python\python39\lib\site-packages (from flask) (1.0.1)
Requirement already satisfied: click>=5.1 in c:\users\dell\appdata\local\programs\python\python39\lib\site-packages (from flask) (7.1.2)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\dell\appdata\local\programs\python\python39\lib\site-packages (from Jinja2>=2.10.1->flask) (1.1.1)
However when I use PyCharm to import flask, it doesn't recognize flask.
ModuleNotFoundError: No module named 'flask'
The most probable problem is py command is related with python2 and flask module is installed in your python3 site-packages. So try to execute explicitly with python3 as :
python3 app.py

How to run a python3 installed package?

I installed a package to python3.7 but when I try to run the executable its getting invoked from python2.7 and it fails as its not present in python3.7
$ sudo -H pip install blobbycompanyconnect --index https://pypi.company.com/simple --user
Looking in indexes: https://pypi.company.com/simple, https://pypi.company.com/simple
Requirement already satisfied: blobbycompanyconnect in /private/var/root/.local/lib/python3.7/site-packages (1.0.0)
Requirement already satisfied: trovecompanyconnect<3.0,>=2.0 in /private/var/root/.local/lib/python3.7/site-packages (from blobbycompanyconnect) (2.0.2)
Requirement already satisfied: filelock==3.0.12 in /private/var/root/.local/lib/python3.7/site-packages (from blobbycompanyconnect) (3.0.12)
Requirement already satisfied: python-dateutil in /private/var/root/.local/lib/python3.7/site-packages (from blobbycompanyconnect) (2.8.1)
Requirement already satisfied: backoff<2.0.0,>=1.8.0 in /private/var/root/.local/lib/python3.7/site-packages (from trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (1.10.0)
Requirement already satisfied: argcomplete<2.0.0,>=1.6.0 in /private/var/root/.local/lib/python3.7/site-packages (from trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (1.12.0)
Requirement already satisfied: pyotp==2.3.0 in /private/var/root/.local/lib/python3.7/site-packages (from trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (2.3.0)
Requirement already satisfied: requests<3.0.0,>=2.18.4 in /private/var/root/.local/lib/python3.7/site-packages (from trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (2.23.0)
Requirement already satisfied: pyaml==19.4.1 in /private/var/root/.local/lib/python3.7/site-packages (from trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (19.4.1)
Requirement already satisfied: six>=1.5 in /private/var/root/.local/lib/python3.7/site-packages (from python-dateutil->blobbycompanyconnect) (1.15.0)
Requirement already satisfied: importlib-metadata<2,>=0.23; python_version == "3.7" in /private/var/root/.local/lib/python3.7/site-packages (from argcomplete<2.0.0,>=1.6.0->trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (1.7.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /private/var/root/.local/lib/python3.7/site-packages (from requests<3.0.0,>=2.18.4->trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (1.25.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /private/var/root/.local/lib/python3.7/site-packages (from requests<3.0.0,>=2.18.4->trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /private/var/root/.local/lib/python3.7/site-packages (from requests<3.0.0,>=2.18.4->trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in /private/var/root/.local/lib/python3.7/site-packages (from requests<3.0.0,>=2.18.4->trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (2.10)
Requirement already satisfied: PyYAML in /private/var/root/.local/lib/python3.7/site-packages (from pyaml==19.4.1->trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (5.3.1)
Requirement already satisfied: zipp>=0.5 in /private/var/root/.local/lib/python3.7/site-packages (from importlib-metadata<2,>=0.23; python_version == "3.7"->argcomplete<2.0.0,>=1.6.0->trovecompanyconnect<3.0,>=2.0->blobbycompanyconnect) (3.1.0)
You are using pip version 19.0.3, however version 20.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Error:-
$ blobbycompanyconnect
Traceback (most recent call last):
File "/usr/local/bin/blobbycompanyconnect", line 6, in <module>
from blobbycompanyconnect.cli import main
File "/Library/Python/2.7/site-packages/blobbycompanyconnect/cli.py", line 6, in <module>
from .companyconnect import get_cli_creds
File "/Library/Python/2.7/site-packages/blobbycompanyconnect/companyconnect.py", line 5, in <module>
from trovecompanyconnect.companyconnect_auth_api import companyconnectAuthApi, AppToApp, BOLTENV
ImportError: No module named trovecompanyconnect.companyconnect_auth_api
Your project runs on 2.7. I don't know if you use a virtual environment, maybe you should upgrade python there or on your IDE mostly on the right bottom you can see your python version check it.

Error while installing pandas using anaconda's jupyter notebook

I installed pandas using anaconda prompt.
using the following command:-
pip install pandas
and get the following message:-
Requirement already satisfied: pandas in c:\users\maini_\anaconda3\lib\site-packages (1.0.3)
Requirement already satisfied: numpy>=1.13.3 in c:\users\maini_\anaconda3\lib\site-packages (from pandas) (1.18.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\maini_\anaconda3\lib\site-packages (from pandas) (2020.1)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\maini_\anaconda3\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\maini_\anaconda3\lib\site-packages (from python-dateutil>=2.6.1->pandas) (1.15.0)
But when I import it in the Jupiter notebook using the following command:-
import pandas as pd
I get the following error:-
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-7dd3504c366f> in <module>
----> 1 import pandas as pd
~\anaconda3\lib\site-packages\pandas\__init__.py in <module>
30
31 try:
---> 32 from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
33 except ImportError as e: # pragma: no cover
34 # hack but overkill to use re
~\anaconda3\lib\site-packages\pandas\_libs\__init__.py in <module>
1 # flake8: noqa
2
----> 3 from .tslibs import (
4 NaT,
5 NaTType,
~\anaconda3\lib\site-packages\pandas\_libs\tslibs\__init__.py in <module>
1 # flake8: noqa
2
----> 3 from .conversion import localize_pydatetime, normalize_date
4 from .nattype import NaT, NaTType, iNaT, is_null_datetimelike
5 from .np_datetime import OutOfBoundsDatetime
pandas\_libs\tslibs\conversion.pyx in init pandas._libs.tslibs.conversion()
AttributeError: type object 'pandas._libs.tslibs.conversion._TSObject' has no attribute '__reduce_cython__'
I also tried this command
python -m pip install pandas
and get the following message
Requirement already satisfied: pandas in c:\users\maini_\anaconda3\lib\site-packages (1.0.3)
Requirement already satisfied: numpy>=1.13.3 in c:\users\maini_\anaconda3\lib\site-packages (from pandas) (1.18.1)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\maini_\anaconda3\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\maini_\anaconda3\lib\site-packages (from pandas) (2020.1)
Requirement already satisfied: six>=1.5 in c:\users\maini_\anaconda3\lib\site-packages (from python-dateutil>=2.6.1->pandas) (1.15.0)
Please help me. Thank you in advance.
Since you are using Anaconda, the best way is to use the anaconda prompt:
conda install pandas

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

Installing Python modules on MacOSX

I'm trying to install the http library through the command "pip install http".
It give me this error:
Command "python setup.py egg_info" failed with error code 1
I just installed setuptools but it doesn't work anyway.
EDIT:
when I launch the command 'pip3 install http' I get this:
pip3 install http
Collecting http
Using cached https://files.pythonhosted.org/packages/e3/91/a9260805e532e33df273b8f7dffad5c51693f8f9ba5f86bedcf42a7f22eb/http-0.02.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/1v/xm2qv7l132sghltfqm3q15wm0000gn/T/pip-install-g44pke5e/http/setup.py", line 3, in <module>
import http
File "/private/var/folders/1v/xm2qv7l132sghltfqm3q15wm0000gn/T/pip-install-g44pke5e/http/http/__init__.py", line 17, in <module>
from request import Request
ImportError: cannot import name 'Request'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/1v/xm2qv7l132sghltfqm3q15wm0000gn/T/pip-install-g44pke5e/http/
I tried many times to check and upload requests package but when I do it I get this:
pip3 install requests
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2.19.1)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests) (2018.4.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests) (1.23)
Requirement already satisfied: idna<2.8,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests) (2.7)
Somebody knows what I made wrong with it?
http version 0.02 was released in 2012. The homepage returns error 404.
I think the package is simply abandoned, broken and outdated. Avoid it or fork it and update it yourself.

Resources