Jupyter Notebook only opens on base environment (Python 3.7, Windows 10) - jupyter-notebook

I'm not sure what changed but similarly to this post:
Jupyter notebook only works in base environment
Jupyter notebook only opens when I activate my base environment, ie:
C:\Users\user\activate base
(base) C:\Users\user\jupyter notebook
This happens on powershell, cmd, and cmder. In the default, unspecified environment, I get this error:
C:\Users\user>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 62, in <module>
from tornado import httpserver
File "C:\Users\user\anaconda3\lib\site-packages\tornado\httpserver.py", line 29, in <module>
import ssl
File "C:\Users\user\anaconda3\lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified procedure could not be found.
In the default environment, I can call pip commands but I get this error. It seems to be related to my first issue above.
C:\Users\user>pip install
Could not fetch URL https://pypi.org/simple/pip/: There was a problem
confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org',
port=443): Max retries exceeded with url: /simple/pip/ (Caused by
SSLError("Can't connect to HTTPS URL because the SSL module is not
available.")) - skipping

Related

Getting following error while runnin juptyer notebook from ananconda prompt

Please let me know the solution to fix it as didn't find much on google.
Faced this error while trying to start jupyter notebook from anaconda.
But can open it from cmd.
Environment variables of anaconda are properly configured.
Traceback (most recent call last):
File "C:\Users\Ankit Chawrai\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\Ankit Chawrai\anaconda3\lib\site-packages\notebook\notebookapp.py", line 51, in <module>
from zmq.eventloop import ioloop
File "C:\Users\Ankit Chawrai\anaconda3\lib\site-packages\zmq\__init__.py", line 50, in <module>
from zmq import backend
File "C:\Users\Ankit Chawrai\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Ankit Chawrai\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\Ankit Chawrai\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Ankit Chawrai\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Ankit Chawrai\anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.```
I always launch Jupyter Notebooks from either from the Windows menu or the Anaconda Navigator. Almost always from the Windows Start Menu.
When I installed Anaconda a shortcut was created within the Start Menu, and when clicked it launches a cmd window, runs some scripts and then opens the Jupyter Explorer page within my default browser.

Jupyter Notebook virtual environment kernel broken: "ImportError: DLL load failed: The specified module could not be found."

I recently modified my conda virtual environment to try installing a package (openjpeg) because of issues I was running into with pydicom. I restarted my Jupyter Notebook, but then it seemed something I did completely messed up my ability to load the environment in Jupyter Notebook. I tried recreating the environment from scratch and manually installing my needed packages, but got the same error. After I load jupyter notebook from command line and open my .ipynb file using the environment kernel, I get the error copied below in the cmd/miniconda window:
[I 00:22:55.851 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
import zmq
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\zmq\__init__.py", line 55, in <module>
from zmq import backend
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\ProgramData\Anaconda3\envs\Py36Base\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\ProgramData\Anaconda3\envs\Py36Base\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.
[W 00:22:58.870 NotebookApp] KernelRestarter: restart failed
[W 00:22:58.870 NotebookApp] Kernel 30d40c82-f840-47cc-8192-54aeb028d1aa died, removing from map.
Any thoughts on what I can do to fix this? I saw some posts with similar errors (but different issue overall) and the most comomon solution was making sure the Anaconda system environment PATH variable is set (which it is). For the record I'm running Windows 10 and latest Anaconda install (first environment using Python 3.8, re-built environment using Python 3.6). If you think I should copy my conda list output for the virtual environment let me know
It seems a rather simple fix was to activate the environment and then run jupyter notebook. That seemed to stop the error. Was not aware this was a requirement?

Apache Airflow initdb command fails, due to syntax error

I have created virtualenv for python3 using:
virtualenv -p $(which python3) ENV
Then activate the source
source /Users/myusername/ENV/bin/activate
Install the apache-airflow:
pip install apache-airflow
then which airflow yields /Users/myusername/ENV/bin/airflow
But when I try to initdb using:
airflow initdb
I get below error:
{db.py:350} INFO - Creating tables
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
WARNI [airflow.utils.log.logging_mixin.LoggingMixin] cryptography not found - values will not be stored encrypted.
ERROR [airflow.models.DagBag] Failed to import: /Library/Python/2.7/site-packages/airflow/example_dags/example_http_operator.py
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/airflow/models/__init__.py", line 413, in process_file
m = imp.load_source(mod_name, filepath)
File "/Library/Python/2.7/site-packages/airflow/example_dags/example_http_operator.py", line 27, in <module>
from airflow.operators.http_operator import SimpleHttpOperator
File "/Library/Python/2.7/site-packages/airflow/operators/http_operator.py", line 21, in <module>
from airflow.hooks.http_hook import HttpHook
File "/Library/Python/2.7/site-packages/airflow/hooks/http_hook.py", line 23, in <module>
import tenacity
File "/Library/Python/2.7/site-packages/tenacity/__init__.py", line 375, in <module>
from tenacity.tornadoweb import TornadoRetrying
File "/Library/Python/2.7/site-packages/tenacity/tornadoweb.py", line 24, in <module>
from tornado import gen
File "/Library/Python/2.7/site-packages/tornado-6.0.3-py2.7-macosx-10.14-intel.egg/tornado/gen.py", line 126
def _value_from_stopiteration(e: Union[StopIteration, "Return"]) -> Any:
^
SyntaxError: invalid syntax
Done.
(ENV) ---------------------------------------------------------
Seems like example scripts use python 2.7 and it can't recognize the function definition syntax.
Does apache-airflow package need to be fixed by the next release or I can do something to fix this?
I tried fixing this:
Use python2.7 instead of python3
then install airflow on default python 2.7 enabled on mac but this throws other errors like package "six" is not compatible.
You need to turn off the example DAGs to be loaded in config file to solve this problem.
Anyway, it seems weird that airflow uses 2.7 Python when you told that it is installed into Python 3 virtual environment.

jupyter notebook kernel crashing non-stop

I have installed Jupyter Notebook through Conda. Been using it for a month without any issues. Suddenly today Jupyter Kernel started crashing and it is failing to restart. One point to note. This opens without any problems: http://localhost:8888/tree but crashes start to happen as soon as I open any notebook (.ipynb file)
(gpd) [arnuld#arch64 geo]$ jupyter-notebook
[I 13:01:24.389 NotebookApp] Serving notebooks from local directory:
/mnt/sda5/knuth/geo [I 13:01:24.389 NotebookApp] The Jupyter Notebook is running at:
[I 13:01:24.390 NotebookApp] http://localhost:8888/?token=d9ad51c90febcccc0b53d575c934396c4b28a65f307ef587
[I 13:01:24.390 NotebookApp] Use Control-C to stop this server and
shut down all kernels (twice to skip confirmation).
[C 13:01:24.457 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time, to login with a token:
http://localhost:8888/?token=d9ad51c90febcccc0b53d575c934396c4b28a65f307ef587
[I 13:01:24.832 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 13:01:51.437 NotebookApp] Kernel started:
a04e2381-690f-410f-a07b-ede5f843b462
Traceback (most recent call last):
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec)
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals)
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/ipykernel/init.py", line 2, in from .connect import *
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/ipykernel/connect.py", line 13, in from IPython.core.profiledir import ProfileDir
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/IPython/init.py", line 55, in from .terminal.embed import embed
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/IPython/terminal/embed.py", line 17, in from IPython.terminal.ipapp import load_default_config
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/IPython/terminal/ipapp.py", line 28, in from IPython.core.magics import (
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/IPython/core/magics/init.py", line 18, in from .code import CodeMagics, MacroToEdit
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/IPython/core/magics/code.py", line 23, in from urllib.request import urlopen
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/urllib/request.py", line 86, in import email
File "/mnt/sda5/knuth/geo/email.py", line 1, in import pandas as pd
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/pandas/init.py", line 23, in from pandas.compat.numpy import *
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/site-packages/pandas/compat/init.py", line 63, in import http.client as httplib
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/http/client.py", line 71, in import email.parser
ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package
[I 13:07:48.306 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec)
..... SNIPPED ......
File "/mnt/sda5/.miniconda3/envs/gpd/lib/python3.7/http/client.py", line 71, in import email.parser
ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package
[W 13:08:00.373 NotebookApp] KernelRestarter: restart failed
[W 13:08:00.374 NotebookApp] Kernel 182b657e-54af-420d-bcdb-910da9391f37 died, removing from map.
[W13:08:45.530 NotebookApp] Timeout waiting for kernel_info reply from 182b657e-54af-420d-bcdb-910da9391f37
[E 13:08:45.533 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: 182b657e-54af-420d-bcdb-910da9391f37)
> File "/mnt/sda5/knuth/geo/email.py", line 1, in
This line told the problem.
In my current working directory there is this file titled "email.py" which contains some code of mine. Since Jupyter Notebok was running from same directory, it thought it is from email-parser package and started looking for something it looks for only in a standard package.
Two Lessons:
In Python, current working directory has highest priority, higher than even location of standard installation.
Never keep generic names for your files in the directory from where you are running Jupyter Notebook or Python else they will conflict with standard packages.
Thanks to Min RK for solving this at gitter channel.

Sikuli keeps getting an error

Sorry im a total noob with this. So ive tried integrating Sikuli in my Working RF setup meaning, I have to move from Python to Jython for this to work. my problem now is that im always getting an error.
Error in file 'C:\robot\suites\Test\Test.robot':
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Traceback (most recent call last):
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\__init__.py", line 2, in <module>
from keywords import *
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\__init__.py", line 1, in <module>
from _logging import _LoggingKeywords
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\_logging.py", line 4, in <module>
from keywordgroup import KeywordGroup
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
PYTHONPATH:
C:\jython2.7.0\bin\jythonsikuli.bat
C:\jython2.7.0\Lib
__classpath__
__pyclasspath__/
C:\jython2.7.0\Lib\site-packages
CLASSPATH:
C:\jython2.7.0\jython.jar
C:\Sikuli\sikulix.jar
20180308 11:23:08.246 ERROR Error in file 'C:\robot\suites\Test\Test.robot':
Getting keyword names from library 'Remote' failed: Calling dynamic method
'get_keyword_names' failed: Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
In your error message there are two issues clearly defined:
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Which can be solved by installing the relevant Python Module from PIP:
pip install decorator
The second issue is towards the end:
Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
This means that Robot Framework is unable to make a connection on port 8720. This is often due to:
Firewalls preventing an opened port to be accessible. In Windows add a FireWall rule allowing for port 8270 to be accessible from the outside.
Try and connect using http://127.0.0.1:8270. Although often a synonym for localhost at a technical level it is not the same.

Resources