Ipython Notebook - ImportError: tornado - ipython

I have already updated tornado using
sudo pip install --upgrade tornado
Checking the current version show that I already have a version later than 4.0
Find the output of command:
pip show tornado | grep Version
Metadata-Version: 1.1
Version: 4.1
Any idea why Ipython notebook does not work and keeps giving me the message that i do not have tornado v4.1 and have version 3.0 instead ?. Thanks and Regards.
=========================================================================
$ipython notebook
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 11, in <module>
sys.exit(start_ipython())
File "/usr/local/lib/python2.7/dist-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 573, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 321, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/application.py", line 369, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 471, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 402, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python2.7/dist-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/usr/local/lib/python2.7/dist-packages/IPython/html/notebookapp.py", line 50, in <module>
raise ImportError(msg + ", but you have %s" % tornado.version)
ImportError: The IPython Notebook requires tornado >= 4.0, but you have 3.2

I had a conflicting copy of tornado (3.1.1 on ubuntu 14.04) as well. To see if this is the case for you, in a terminal use the commands:
apt-cache policy python-tornado
To print out the OS's version. If it is not the version you want, use:
sudo apt-get remove python-tornado
to remove it. If you had already installed the newer version using pip, that version will be visible to python now.

Maybe have many pip and many Python's. Check your pip version
pip --version
(my response) pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
and check you IPython environment:
~$ ipython3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- An enhanced Interactive Python.
If environ version are the same. Try make new environ on virtualenv

I have noticed that there were two Tornado packages installed on my system(Ubuntu 14.04). A Tornado 4.1 version and Tornado 3.2 version under different folders. In order to solve the problem, i renamed the folder containing the old Tornado to "Tornado-OLD".
Now Ipython Notebook is able to find the right Tornado and open on the browser.
I am not sure how it happened to have 2 versions of Torando installed, at the same time. But if you have the problem, this can probably help you.
Thanks for the contributions.
Regards
Gustavo

Maybe you can try:
sudo apt-get remove tornado
sudo pip uninstall tornado
sudo pip install tornado

The following worked for me:
Remove tornado:
sudo apt-get remove python-tornado
Reinstall tornado:
sudo pip install tornado
Upgrade tornado:
sudo pip install tornado --upgrade

Related

Running odoo in Debugging VSCode and found error ModuleNotFoundError: No module named 'stdnum' - - -

i using VSCode as my IDE for development odoo and for now run using Start > Debugging ( F5)
While running at web browser localhost:8069 ( default ) then appear
Internal Server Error and in terminal VSCode there are errors :
Traceback (most recent call last):
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/registry.py", line 63, in __new__
return cls.registries[db_name]
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/tools/func.py", line 71, in wrapper
return func(self, *args, **kwargs)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
KeyError: 'usu02' #this my database name
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/teguhteja/P/OdooProject/odoo1/.venv/lib/python3.7/site-packages/werkzeug/serving.py", line 323, in run_wsgi
execute(self.server.app)
File "/home/teguhteja/P/OdooProject/odoo1/.venv/lib/python3.7/site-packages/werkzeug/serving.py", line 312, in execute
application_iter = app(environ, start_response)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/service/server.py", line 441, in app
return self.app(e, s)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/service/wsgi_server.py", line 113, in application
return application_unproxied(environ, start_response)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/service/wsgi_server.py", line 88, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/http.py", line 1306, in __call__
return self.dispatch(environ, start_response)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/http.py", line 1272, in __call__
return self.app(environ, start_wrapped)
File "/home/teguhteja/P/OdooProject/odoo1/.venv/lib/python3.7/site-packages/werkzeug/middleware/shared_data.py", line 260, in __call__
return self.app(environ, start_response)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/http.py", line 1461, in dispatch
odoo.registry(db).check_signaling()
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/__init__.py", line 104, in registry
return modules.registry.Registry(database_name)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/registry.py", line 65, in __new__
return cls.new(db_name)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/loading.py", line 457, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/loading.py", line 349, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/loading.py", line 179, in load_module_graph
load_openerp_module(package.name)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/module.py", line 385, in load_openerp_module
__import__('odoo.addons.' + module_name)
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/addons/base_vat/__init__.py", line 4, in <module>
from . import models
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/addons/base_vat/models/__init__.py", line 6, in <module>
from . import res_partner
File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/addons/base_vat/models/res_partner.py", line 7, in <module>
import stdnum
ModuleNotFoundError: No module named 'stdnum' - - -
and i tried to searching and found here
How to fix "ModuleNotFoundError: No module named 'python-stdnum'"
UnicodeDecodeError: 'charmap' codec| Error during installation of pip python-stdnum==1.8
and then
pip install python-stdnum == 1.17 # new version
but result is same. and i check about my pip list
pip list
appdirs 1.4.4
attrs 21.2.0
Babel 2.6.0
backcall 0.2.0
bcrypt 3.2.0
beautifulsoup4 4.10.0
cached-property 1.5.2
certifi 2021.10.8
cffi 1.15.0
chardet 3.0.4
decorator 4.3.0
defusedxml 0.7.1
docutils 0.14
ebaysdk 2.1.5
freezegun 0.3.11
future 0.18.2
gevent 1.5.0
greenlet 0.4.15
html2text 2018.1.9
idna 2.6
ipdb 0.13.9
ipython 7.30.1
isodate 0.6.0
jedi 0.18.1
Jinja2 2.10.1
libsass 0.17.0
lxml 4.3.2
Mako 1.0.7
MarkupSafe 1.1.0
matplotlib-inline 0.1.3
num2words 0.5.6
ofxparse 0.19
parso 0.8.3
passlib 1.7.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 5.4.1
pip 21.3.1
polib 1.1.0
prompt-toolkit 3.0.24
psutil 5.8.0
psycopg2 2.7.7
ptyprocess 0.7.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.21
pydot 1.4.1
Pygments 2.10.0
pyodbc 4.0.32
pyparsing 3.0.6
PyPDF2 1.26.0
pyserial 3.4
python-dateutil 2.7.3
python-ldap 3.1.0
python-stdnum 1.17
pytz 2019.1
pyusb 1.0.2
pyzk 0.9
qrcode 6.1
reportlab 3.5.13
requests 2.21.0
requests-toolbelt 0.9.1
setuptools 41.2.0
six 1.16.0
soupsieve 2.3.1
toml 0.10.2
traitlets 5.1.1
urllib3 1.24.3
vobject 0.9.6.1
wcwidth 0.2.5
Werkzeug 0.16.1
wheel 0.37.0
xlrd 1.1.0
XlsxWriter 1.1.2
xlwt 1.3.0
and i found my python-stdnum already installed
i suspect my problem at launch.json vscode
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Odoo",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"python": "${command:python.interpreterPath}",
// "console": "externalTerminal",
"program": "${workspaceRoot}/odoo-14.0/odoo-server",
"args": [
"--config=${workspaceRoot}/conf/odoo-training14.conf",
],
"cwd": "${workspaceRoot}",
// "env": {},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"RedirectOutput"
]
}
]
}
how to fix my problem ?
ALTERNATIVE
currently i run odoo using below command and for debug using ipdb
python3 odoo-14.0/odoo-server -c conf/odoo-training14.conf
After trying for a few days and just found out that pip and python in the project are not pointing to .venv but to anaconda due to an update. when error
no module stdnum
actually there is a problem with pip so make sure your pip path with which pip or which python
to solve .venv that doesn't work by deleting the .venv folder, create venv in python, and install all requirements again
rm .venv
python3 -m venv .venv
source .venv/bin/activate.fish
python3 -m pip install --upgrade pip # upgrade pip
pip install -r requirements.txt
since it uses vscode make sure your interpreter with
ctrl + shift + P then
Python : Select Interpreter
and choose your .venv
after that you can debug as usual

Rasa NLU installation issue

I had rasa nlu version 0.12.3 installed. I had some issues and uninstalled rasa nlu and other requirements using
pip uninstall rasa_nlu
pip uninstall -r requirements.txt
Now when I am installing rasa nlu again using pip install rasa_nlu
I see below messages in the terminal
Error processing line 1 of /Users/uername/anaconda3/lib/python3.6/site-packages/matplotlib-2.0.2-py3.6-nspkg.pth:
Traceback (most recent call last):
File "/Users/username/anaconda3/lib/python3.6/site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 557, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Remainder of file ignored
There are more messages regarding installation and the final message is
Found existing installation: greenlet 0.4.12
Cannot uninstall 'greenlet'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
And it turns out that rasa nlu is not installed. I know that the nlu is not installed because when I check the nlu version with below command
python -c "import rasa_nlu; print(rasa_nlu.__version__);"
I get error
Error processing line 1 of /Users/username/anaconda3/lib/python3.6/site-packages/matplotlib-2.0.2-py3.6-nspkg.pth:
Traceback (most recent call last):
File "/Users/username/anaconda3/lib/python3.6/site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 557, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Remainder of file ignored
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'rasa_nlu'
Turns out the problem was happening due to a distutils installed project which the pip install couldn't uninstall before installation.
So I had to use --ignore-installed
In short, below command solved the problem
sudo pip install --ignore-installed rasa_nlu
If you want to uninstall python package which is part of distutils, you can manually remove the folder from 'site-packages' folder. If it is Anaconda distribution, it will be in following folder. I suggest to cut the folder and paste it somewhere else for the backup purpose.
In windows:
C:\Users\\AppData\Local\Continuum\Anaconda3\Lib\site-packages
I'm sure Linux will have similar folder structure.
Following 2 items needs to be removed.
Folder [package version no.]
File - [package>.egg-info]
As mentioned in Rasa's official documentation, Install it with
pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple
It will install Rasa X and Rasa. It works great.
pip3 install rasa-x -U --extra-index-url https://pypi.rasa.com/simple
installation guide

Installing google-cloud-vision

I'm new to raspberry pi, google cloud, python, somewhat new to linux and would like a suggestion on how to fix/debug this problem. I'm getting an error when I install the Cloud Vision API Client Libraries for python.
It seems that this installation breaks pip and pip3 on raspian. Here's how I reproduced the problem from a fresh install of raspian:
pi#raspberrypi:~ $ pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
pi#raspberrypi:~ $
pi#raspberrypi:~ $ sudo pip install --upgrade google-cloud-vision
...
...
At the end of the log:
Running setup.py install for dill
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-1dbzT3/dill/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lUJmAy-record/install-record.txt --single-version-externally-managed --compile:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version
Afterwards, when I run pip, I get this:
pi#raspberrypi:~ $ pip --version
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version
I'm not sure how to go about fixing this.
There's a trick to installing the cloud client libraries on Raspberry Pi: install virtualenv and sphinx first. The following steps will get you going:
sudo apt-get install python-pip virtualenv python-dev
virtualenv env
source env/bin/activate
pip install sphinx
pip install --upgrade google-cloud-vision
python

upgrading scipy in mac

I want to upgrade scipy. and I used pip install scipy --upgrade to do this, but here is error, how should I fix this?
Installing collected packages: scipy
Found existing installation: scipy 0.13.0b1
DEPRECATION: Uninstalling a distutils installed project (scipy) 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 scipy-0.13.0b1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/7x/1ly_pjjd3g50632kc7mc68n00000gn/T/pip-a37H18-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy-0.13.0b1-py2.7.egg-info'
Python version 2.7.10
Mac version 10.12.04
I tried to install face_recognition, then display the same problem.
sudo pip install face_recognition
try use:
sudo pip install --upgrade scipy --ignore-installed six

Virtualenv causing setuptools error

I am having trouble running a virtualenv, and I keep getting this same error code: "setuptools pip wheel failed with error code 1"
I saw some pages talking about how this is a discrepancy between different versions of setuptools, but I've uninstalled and reinstalled virtualenv and setuptools in several versions to no results. Does anyone know what's happening here?
Roberts-MacBook-Air:script Rob$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools, pip, wheel...
Complete output from command /Users/Rob/Seedstages/script/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/__init__.py", line 13, in <module>
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/utils/__init__.py", line 15, in <module>
File "/Users/Rob/anaconda/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "/Users/Rob/anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/Rob/Seedstages/script/venv/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/Rob/Seedstages/script/venv/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/Users/Rob/anaconda/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 1004, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 969, in install_wheel
'PIP_NO_INDEX': '1'
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 910, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/Rob/Seedstages/script/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1
Roberts-MacBook-Air:script Rob$
I would say that Anaconda causes the conflict, though to be more specific, it appears as if Anaconda's virtualenv is the problem. Running which virtualenv on my macbook (where I'm having the same problem) yields /Users/me/anaconda/bin/virtualenv while running it on the linux system I just tested this on yields /usr/local/bin/virtualenv.
So, on OS X, I downloaded virtualenv using /usr/local/bin/pip install virtualenv. This doesn't create a virtualenv binary (or it didn't for me) in the PATH folders, so I had to type this painfully long command:
sudo /usr/local/bin/python ... {the path to virtualenv.py in the system python's site-packages folder} new_env
And that did it. But that's ridiculous. No one wants to do that - even creating links would still be hacking it when you don't need to.
According to the ContinuumIO github page on this very subject, the virtualenv env and source /bin/activate commands are replaced with conda create -n env python=2.7 and source activate env.
Tested on my macbook (running Anaconda2 v4 on OS Yosemite) and it worked out.