Problem when importing distributed on Ubuntu 18.04 - python-3.6

I am trying to import distributed version 1.22.0 installed with pip3.
However, I get this error :
>>> import distributed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/distributed/__init__.py", line 5, in <module>
from .core import connect, rpc
File "/usr/local/lib/python3.6/dist-packages/distributed/core.py", line 25, in <module>
from .system_monitor import SystemMonitor
File "/usr/local/lib/python3.6/dist-packages/distributed/system_monitor.py", line 4, in <module>
import psutil
File "/home/users/ej/.local/lib/python3.6/site-packages/psutil/__init__.py", line 100, in <module>
from . import _pslinux as _psplatform
File "/home/users/ej/.local/lib/python3.6/site-packages/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: /home/users/ej/.local/lib/python3.6/site-packages/psutil/_psutil_linux.cpython-36m-x86_64-linux-gnu.so: failed to map segment from shared object
>>>
I have dask version 0.18.1 installed with pip3.
I work on Ubuntu 18.04 with python3.
I tried reinstall and install but no solution.
Could you help me please ?
Thanks in advance.

Related

Getting an error while opening jupyter Notebook in Ubuntu

Traceback (most recent call last):
File "/home/mohit/anaconda3/bin/jupyter-notebook", line 7, in
from notebook.notebookapp import main
File "/home/mohit/anaconda3/lib/python3.8/site-packages/notebook/notebookapp.py", line 83, in
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
File "/home/mohit/anaconda3/lib/python3.8/site-packages/notebook/services/kernels/kernelmanager.py", line 18, in
from jupyter_client.session import Session
File "/home/mohit/anaconda3/lib/python3.8/site-packages/jupyter_client/session.py", line 41, in
from jupyter_client.jsonutil import extract_dates, squash_dates, date_default
File "/home/mohit/anaconda3/lib/python3.8/site-packages/jupyter_client/jsonutil.py", line 10, in
from dateutil.parser import parse as _dateutil_parse
File "/home/mohit/anaconda3/lib/python3.8/site-packages/dateutil/parser.py", line 158
l.append("%s=%s" % (attr, `value`))
^
SyntaxError: invalid syntax
pip install python-dateutil --upgrade will solve your problem

cannot import name 'IncorrectSchemaTypeError while running airflow initdb

I'm running with:
ubuntu 18.04.4 LTS
python 3.6.9
I install aitflow with:
pip install apache-airflow
and tried to init the db:
airflow initdb
And get the following error:
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 26, in <module>
from airflow.bin.cli import CLIFactory
File "/home/ubadmin/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 71, in <module>
from airflow.www_rbac.app import cached_app as cached_app_rbac
File "/home/ubadmin/.local/lib/python3.6/site-packages/airflow/www_rbac/app.py", line 27, in <module>
from flask_appbuilder import AppBuilder, SQLA
File "/home/ubadmin/.local/lib/python3.6/site-packages/flask_appbuilder/__init__.py", line 5, in <module>
from .api import ModelRestApi # noqa: F401
File "/home/ubadmin/.local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 14, in <module>
from marshmallow_sqlalchemy.fields import Related, RelatedList
File "/home/ubadmin/.local/lib/python3.6/site-packages/marshmallow_sqlalchemy/__init__.py", line 4, in <module>
from .schema import TableSchemaOpts, ModelSchemaOpts, TableSchema, ModelSchema
File "/home/ubadmin/.local/lib/python3.6/site-packages/marshmallow_sqlalchemy/schema/__init__.py", line 3, in <module>
from .sqlalchemy_schema import (
File "/home/ubadmin/.local/lib/python3.6/site-packages/marshmallow_sqlalchemy/schema/sqlalchemy_schema.py", line 7, in <module>
from ..exceptions import IncorrectSchemaTypeError
ImportError: cannot import name 'IncorrectSchemaTypeError
How can I fix it ?
Got the same failure.
Fixed it by reinstalling airflow with contraints, like mentioned in the official docs: https://airflow.apache.org/docs/stable/installation.html
AIRFLOW_VERSION=1.10.12
PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)"
CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
# For example: 3.6
# https://raw.githubusercontent.com/apache/airflow/constraints1.10.12/constraints-3.6.txt
pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"

unable to initialize airflow database after installing airflow

I installed on a fresh version of airflow using Python 3.7.4 on Mac OS Catalina 10.15.1.
By running:
$ pip install 'apache-airflow[s3,postgres,celery,hdfs,jdbc,hive,slack,crypto,redis]==1.10.4'
When I run:
$ airflow initidb
I get the following error message:
Traceback (most recent call last):
File "/Users/user/opt/anaconda3/bin/airflow", line 21, in <module>
from airflow import configuration
File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/airflow/__init__.py", line 31, in <module>
from airflow.utils.log.logging_mixin import LoggingMixin
File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/airflow/utils/__init__.py", line 24, in <module>
from .decorators import apply_defaults as _apply_defaults
File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/airflow/utils/decorators.py", line 34, in <module>
from airflow import settings
File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/airflow/settings.py", line 36, in <module>
from airflow.configuration import conf, AIRFLOW_HOME, WEBSERVER_CONFIG # NOQA F401
File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/airflow/configuration.py", line 29, in <module>
from future import standard_library
ValueError: source code string cannot contain null bytes
I'm wondering if anyone has any suggestions.
Thanks.
I think I figured it out. The future module I had was corrupt, so I just re-installed things and it seems to work now.

Jupyter will not launch from Anaconda Navigator 32bit

I read where running installing pyqt5 or pip install pyqt5 would correct this error. Did not work for my enviornment. Any suggestions?
Traceback (most recent call last):
File "C:\Users\Paula\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 10, in
import sqlite3
File "C:\Users\Paula\Anaconda3\lib\sqlite3\__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Users\Paula\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Paula\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\Paula\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in
from .services.sessions.sessionmanager import SessionManager
File "C:\Users\Paula\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 13, in
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'

ImportError: No module named cryptography.hazmat.backends - anaconda on windows

I am using the Anaconda environment for python.
I have installed the paramiko (v. 2.0.2) and cryptography (v 1.5) modules using the Anaconda Navigator..
When I try to execute this import statement:
import netmiko
I get an error message "ImportError: No module named cryptography.hazmat.backends"
The total output in the cmd window is:
>>> import netmiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\netmiko\__init__.py", line 1, in <module>
File "build\bdist.win-amd64\egg\netmiko\ssh_dispatcher.py", line 3, in <module>
File "build\bdist.win-amd64\egg\netmiko\cisco\__init__.py", line 1, in <module>
File "build\bdist.win-amd64\egg\netmiko\cisco\cisco_ios_ssh.py", line 1, in <module>
File "build\bdist.win-amd64\egg\netmiko\ssh_connection.py", line 3, in <module>
File "build\bdist.win-amd64\egg\netmiko\base_connection.py", line 13, in <module>
File "build\bdist.win-amd64\egg\paramiko\__init__.py", line 30, in <module>
File "build\bdist.win-amd64\egg\paramiko\transport.py", line 32, in <module>
ImportError: No module named cryptography.hazmat.backends
Does anyone know how to fix this?
Any help is appreciated.
I guess the right order for the commands would be:
#apt-get update
#apt-get install python-dev
#apt-get install libffi-dev
#pip install cryptography
It solved the issue in my case
You're probably running into a problem because you don't have libffi-dev installed. Installing "python-dev" and "libffi-dev" at the OS layer may help.

Resources