Create a virtualenv to run jupyter - python

I have created a new virtualenv and named it python with command virtualenv python.
output:
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/dema/python/bin/python3.7
Also creating executable in /Users/dema/python/bin/python
Installing setuptools, pip, wheel...
done.
Then I activate it with commande source python/bin/activate
Then I installed jupyter notebook with commande pip3 install notebook
Then I try running the notebook with command jupyter notebook
The error:
Traceback (most recent call last):
File "/anaconda2/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/anaconda2/lib/python2.7/site-packages/notebook/notebookapp.py", line 60, in <module>
from tornado import httpserver
File "/anaconda2/lib/python2.7/site-packages/tornado/httpserver.py", line 33, in <module>
from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters
File "/anaconda2/lib/python2.7/site-packages/tornado/http1connection.py", line 30, in <module>
from tornado import iostream
File "/anaconda2/lib/python2.7/site-packages/tornado/iostream.py", line 40, in <module>
from tornado.netutil import ssl_wrap_socket, _client_ssl_defaults, _server_ssl_defaults
File "/anaconda2/lib/python2.7/site-packages/tornado/netutil.py", line 44, in <module>
_client_ssl_defaults = ssl.create_default_context(
AttributeError: 'module' object has no attribute 'create_default_context'
Why do Anaconda and python2.7 come into this when I am using an active env with python3.7? I am totally unable to understand.

Related

Jupyter Notebook launch fail from terminal

I am getting the following error message on launching Jupyter Notebook. I did conda update all already, but to no avail.
Traceback (most recent call last):
File "/Users/sparshbohra/opt/anaconda3/bin/jupyter-Notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 81, in <module>
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 18, in <module>
from jupyter_client.session import Session
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/session.py", line 41, in <module>
from jupyter_client.jsonutil import extract_dates, squash_dates, date_default
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/jsonutil.py", line 10, in <module>
from dateutil.parser import parse as _dateutil_parse
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/dateutil/parser.py", line 158
l.append("%s=%s" % (attr, `value`))
^
SyntaxError: invalid syntax
Would probably need a little mote information on how you're trying to launch it, on what system and what program etc. But assuming you have conda installed and the environment activated via conda activate my_env_path_name, you should be able to launch jupyter notebooks by typing jupyter notebook

Import error while trying to run jupyter notebook

An import error occurs when trying to run jupyter notebook
I'm trying to run jupyter notebook using anaconda (git bash platform), and as I type in jupyter notebook, an import error occurs every time. I tried to lauch it inside an environment, but the same error occured.
$ jupyter notebook
Traceback (most recent call last):
File "C:\Users\User\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
<module>
from notebook.notebookapp import main
File "C:\Users\User\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 47, in <module>
from zmq.eventloop import ioloop
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
EDITED
After reinstalling pyzmq (and I tried reinstalling conda too), the following error occurs:
$ jupyter notebook
Traceback (most recent call last): File
"C:\Users\User\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",
line 10, in
import sqlite3
File "C:\Users\User\Anaconda3\lib\sqlite3__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Users\User\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\User\Anaconda3\Scripts\jupyter-notebook-script.py", line 6,
in
from notebook.notebookapp import main
File
"C:\Users\User\Anaconda3\lib\site-packages\notebook\notebookapp.py",
line 86, in
from .services.sessions.sessionmanager import SessionManager
File
"C:\Users\User\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",
line 13, in
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
I found a similar issue open on GitHub for zmq. The recommendation by GitHub user harsh23tyagi that seems to work for most is to run the following:
pip uninstall pyzmq
pip install pyzmq
Working with conda env, jupyter notebook worked in (base) env but gave the .libzmq error in (my_env).
To be able to run notebooks from my_env, this worked for me :
pip uninstall pyzmq
pip install pyzmq==20 (no version for pyzmq didn't fix the issue for me)
It seems that updating pyzmq to the latest version fixes this problem for me.
conda install pyzmq=22

Cannot open Jupyter notebook using Anaconda python 3.6.1

When I use the command jupyter notebook I get the following error and traceback:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Traceback (most recent call last):
File "/Users/hamedbh/anaconda3/bin/jupyter-notebook", line 4, in <module>
import notebook.notebookapp
File "/usr/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 31, in <module>
from zmq.eventloop import ioloop
File "/usr/local/lib/python2.7/site-packages/zmq/__init__.py", line 34, in <module>
from zmq import backend
File "/usr/local/lib/python2.7/site-packages/zmq/backend/__init__.py", line 40, in <module>
reraise(*exc_info)
File "/usr/local/lib/python2.7/site-packages/zmq/utils/sixcerpt.py", line 34, in reraise
raise value
File "/usr/local/lib/python2.7/site-packages/zmq/backend/__init__.py", line 27, in <module>
_ns = select_backend(first)
File "/usr/local/lib/python2.7/site-packages/zmq/backend/select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
ModuleNotFoundError: No module named 'zmq.backend.cython'
I am using the full Anaconda distribution, and although I have created an environment I did this from the root Anaconda env (i.e. /Users/me/anaconda3) and not within an env.
Some quick details that may help with figuring out the problem:
python --version = Python 3.6.1 :: Anaconda 4.4.0 (x86_64)
OS is MacOS Sierra 10.12.6
I don't know whether the same thing that is causing the KeyError: PYTHONPATH is also causing jupyter notebook to fail.
It seems that pyzmq is the problem. Run pip install pyzmq --upgrade or pip unistall pyzmq & pip install pyzmq to make sure you're on the latest version of it.

How can I start spyder python 3.5

I am having trouble starting spyder (I have installed Anaconda 64 bit version python 3.5). When I run spyder or spyder.exe in cmd I see the green logo of spyder but nothing happens afterwards, except that I get an error msg:
(C:\Program Files\Anaconda3) C:\WINDOWS\system32>spyder
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\Scripts\spyder-script.py", line 5, in <module>
sys.exit(spyder.app.start.main())
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\app\start.py", line 103, in main
from spyder.app import mainwindow
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 154, in <module>
from spyder.utils.environ import WinUserEnvDialog
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\utils\environ.py", line 20, in <module>
from spyder.widgets.variableexplorer.collectionseditor import CollectionsEditor
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 45, in <module>
from spyder.widgets.variableexplorer.importwizard import ImportWizard
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\widgets\variableexplorer\importwizard.py", line 26, in <module>
import pandas as pd
File "C:\Program Files\Anaconda3\lib\site-packages\pandas\__init__.py", line 37, in <module>
import pandas.core.config_init
File "C:\Program Files\Anaconda3\lib\site-packages\pandas\core\config_init.py", line 14, in <module>
import pandas.core.config as cf
AttributeError: module 'pandas' has no attribute 'core'
I am running Win 10 Pro 64bit
If you want to install Spyder directly, you need to follow these steps:
Install the essential requirements:
Python2.7+ or 3.4+
PyQt5 (recommended) or PyQt4
Install Spyder and its dependencies by running this command:
pip install spyder
For more read this :https://docs.continuum.io/anaconda/ide_integration

Jupyter install for Python 2.7 failed

I have the Anaconda distribution of Python 2.7 and I needed to install the Jupyter notebook package. During the installation process my computer turned off and after that I couldn't continue with the process. I tried to uninstall Jupyter and try installing it again, but I keep getting the same error:
Traceback (most recent call last):
File "C:\Users\Acer\Anaconda\Scripts\ipython-script.py", line 3, in <module>
from IPython import start_ipython
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 22, in <module>
from IPython.core.completer import IPCompleter
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\core\completer.py", line 71, in <module>
from IPython.utils import generics
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\utils\generics.py", line 8, in <module>
from simplegeneric import generic
ImportError: No module named simplegeneric
What should I remove/add in order to make it work?
You need to install the python package simplegeneric. After you install it, you need to install the next package that you fail to import. Continue this process until you dont get any import errors.

Categories