Software stack version:
Spyder 3.2.4
Python 3.5
Zipline 1.1.1
OSX El capitan
When running Zipline from terminal just to try it out:
$ zipline run -f buyapple.py --start 2000-1-1 --end 2014-1-1 -o buyapple_out.pickle
The following error appears:
[2017-12-06 13:17:02.124791] INFO: Loader: Cache at /.../.zipline/data/SPY_benchmark.csv does not have data from 1990-01-02 00:00:00+00:00 to 2017-12-04 00:00:00+00:00.
[2017-12-06 13:17:02.136427] INFO: Loader: Downloading benchmark data for 'SPY' from 1989-12-29 00:00:00+00:00 to 2017-12-04 00:00:00+00:00
Traceback (most recent call last):
File "/Users/newuer/anaconda3/bin/zipline", line 11, in <module>
load_entry_point('zipline==1.1.1', 'console_scripts', 'zipline')()
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/zipline/__main__.py", line 97, in _
return f(*args, **kwargs)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/zipline/__main__.py", line 240, in run
environ=os.environ,
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/zipline/utils/run_algo.py", line 132, in _run
env = TradingEnvironment(asset_db_path=connstr, environ=environ)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/zipline/finance/trading.py", line 99, in __init__
self.bm_symbol,
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/zipline/data/loader.py", line 166, in load_market_data
environ,
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/zipline/data/loader.py", line 230, in ensure_benchmark_data
last_date,
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/zipline/data/benchmarks.py", line 50, in get_benchmark_returns
last_date
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/pandas_datareader/data.py", line 137, in DataReader
session=session).read()
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/pandas_datareader/base.py", line 181, in read
params=self._get_params(self.symbols))
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/pandas_datareader/base.py", line 79, in _read_one_data
out = self._read_url_as_StringIO(url, params=params)
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/pandas_datareader/base.py", line 98, in _read_url_as_StringIO
out.write(bytes_to_str(text))
File "/Users/newuer/anaconda3/lib/python3.5/site-packages/pandas/compat/__init__.py", line 72, in bytes_to_str
return b.decode(encoding or 'utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 18112: invalid start byte
I have also tried putting the SPY_benchmark_data.csv directly inside the .zipline/data/ folder, and still the error is produced.
I have also tried a clean install of conda and python env 3.4 -- same issue.
Related
I've been trying to set up a virtual environment for django using pipenv. I've installed pipenv and configured the path properly. When I run the following command
pipenv --version
I get
pipenv, version 2022.9.8
Which implies that pipenv is working.
But when I attempt to install django with the following command
pipenv install django
I get the following error.
C:\Users\Saifia>pipenv install django
Traceback (most recent call last):
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 620, in parse_executable
result_version = get_python_version(path)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\utils.py", line 97, in get_python_version
c = subprocess.Popen(version_cmd, **subprocess_kwargs)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\cli\options.py", line 57, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\cli\command.py", line 236, in install
do_install(
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\core.py", line 2056, in do_install
ensure_project(
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\core.py", line 526, in ensure_project
ensure_virtualenv(
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\core.py", line 447, in ensure_virtualenv
python = ensure_python(project, three=three, python=python)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\core.py", line 336, in ensure_python
path_to_python = find_a_system_python(python)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\core.py", line 302, in find_a_system_python
return next(iter(finder.find_all_python_versions()), None)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 307, in find_all_python_versions
python_version_dict = getattr(self.system_path, "python_version_dict", {})
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 115, in system_path
self._system_path = self.create_system_path()
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 77, in create_system_path
return pyfinder_path.SystemPath.create(
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 696, in create
instance = instance._run_setup()
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 247, in _run_setup
new_instance = new_instance._setup_windows()
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 425, in _setup_windows
windows_finder = WindowsFinder.create()
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 149, in create
return cls()
File "<attrs generated init pythonfinder.models.windows.WindowsFinder>", line 13, in __init__
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 116, in get_versions
versions[py_version.version_tuple[:5]] = base_dir
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 367, in __getattribute__
result = super(PythonVersion, self).__getattribute__(key)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 432, in version_tuple
self.patch,
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 377, in __getattribute__
instance_dict = self.parse_executable(executable)
File "C:\Users\Saifia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 622, in parse_executable
raise ValueError("Not a valid python path: %r" % path)
ValueError: Not a valid python path: 'C:/Users/Saifia/anaconda3/Scripts/python.exe'
I've been trying to figure this out the whole day and have tried various things but I'm new this and I can't figure out my mistake.
Any help will be greatly appreciated!
I was using virtualenv for virtualization and had to use pipenv to follow a tutorial and could not get pipenv to work. I had to uninstall virtualenv and pipenv and reinstall pipenv for it to work. I am still using pipenv but I do not like it virtualenv works better for me.
I think that the key to your problem is the last message in the traceback:
"ValueError: Not a valid python path: 'C:/Users/Saifia/anaconda3/Scripts/python.exe'"
Check and see if this file exists at this location.
If not, your default python version isn't set correctly in pipenv.
Deactivate any virtual environment and check your python version before you install pipenv.
I hope you're doing well.
I am trying to follow the Pixiedust installation as laid out on the official github (https://pixiedust.github.io/pixiedust/install.html), and install it in windows 10 (64 bit).
when I try to execute instruction “jupyter pixiedust install” I get this error as “OSError: [WinError 193] %1 is not a valid Win32 application”. Let me say this too I was installed Spark (2.4.7) before. I will be very grateful if you help me.
(base) C:\>jupyter pixiedust install
←[32;1mStep 1: PIXIEDUST_HOME: C:\Pixiedust←[0m
Keep y/n [y]? y
←[32;1mStep 2: SPARK_HOME: C:\Spark\spark-2.4.7-bin-hadoop2.7←[0m
Keep y/n [y]? y
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\jupyter-pixiedust-script.py", line 33, in <module>
sys.exit(load_entry_point('pixiedust', 'console_scripts', 'jupyter-pixiedust')())
File "c:\pixiedust\install\pixiedustapp.py", line 41, in main
PixiedustJupyterApp.launch_instance()
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 844, in launch_instance
app.initialize(argv)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 333, in initialize
self.parse_command_line(argv)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 684, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 603, in initialize_subcommand
self.subapp.initialize(argv)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Anaconda3\lib\site-packages\jupyter_core\application.py", line 241, in initialize
self.parse_command_line(argv)
File "c:\pixiedust\install\createKernel.py", line 154, in parse_command_line
spark_version = self.get_spark_version()
File "c:\pixiedust\install\createKernel.py", line 379, in get_spark_version
pyspark_out = subprocess.check_output([pyspark, "--version"], stderr=subprocess.STDOUT).decode("utf-8")
File "C:\Anaconda3\lib\subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Anaconda3\lib\subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Anaconda3\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Anaconda3\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application
(base) C:\>
I have set up Airflow on an AWS EC2 server with Ubuntu 18.04, Python 3.6.9. The DB backend is a 5.7.26 MySQL, I am using a LocalExecutor. The setup is nothing more than:
apt-get install python3 python3-pip python3-venv libmysqlclient-dev
I install Airflow with pip3 install apache-airflow[mysql]==1.10.9, init DB connection, start the webserver and it works both normally and with -D. The scheduler, however, works only when run in the foreground. Trying to run it as a daemon fails with the following trace:
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 37, in <module> args.func(args)
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/cli.py", line 75, in wrapper return f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/bin/cli.py", line 1032, in schedulerjob.run()
File "/usr/local/lib/python3.6/dist-packages/airflow/jobs/base_job.py", line 215, in run session.commit()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 1036, in commit self.transaction.commit()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 503, in commitself._prepare_impl()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 482, in _prepare_impl self.session.flush()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 2496, in flushself._flush(objects)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 2637, in _flush transaction.rollback(_capture_exception=True)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/langhelpers.py", line 69, in __exit__exc_value, with_traceback=exc_tb,
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 178, in raise_raise exception
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 2597, in _flush flush_context.execute()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute rec.execute(self)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute uow,
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/persistence.py", line 213, in save_obj) in _organize_states_for_save(base_mapper, states, uowtransaction):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/persistence.py", line 374, in _organize_states_for_save base_mapper, uowtransaction, states
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/persistence.py", line 1602, in _connections_for_states connection = uowtransaction.transaction.connection(base_mapper)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 313, in connection return self._connection_for_bind(bind, execution_options)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 420, in _connection_for_bind conn = self._parent._connection_for_bind(bind, execution_options)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/session.py", line 432, in _connection_for_bind conn = bind._contextual_connect()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 2251, in _contextual_connect self._wrap_pool_connect(self.pool.connect, None),
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 2285, in _wrap_pool_connect return fn()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 363, in connect return _ConnectionFairy._checkout(self)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 804, in _checkout result = pool._dialect.do_ping(fairy.connection)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 138, in do_pingdbapi_connection.ping(False)
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 546, in ping self._execute_command(COMMAND.COM_PING, "")
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 771, in _execute_command self._write_bytes(packet)
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 711, in _write_bytesself._sock.settimeout(self._write_timeout)
OSError: [Errno 9] Bad file descriptor
Exception ignored in: <function _ConnectionRecord.checkout.<locals>.<lambda> at 0x7f2eb025e268>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 503, in <lambda>
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool/base.py", line 702, in _finalize_fairy
File "/usr/lib/python3.6/logging/__init__.py", line 1337, in error
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
File "/usr/lib/python3.6/logging/__init__.py", line 1071, in emit
File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
NameError: name 'open' is not defined
I am trying to set up a server for semi-production purposes, so this is actually a blocker for me. I would be grateful for any advice.
EDIT
I tried using mysql-connector-python==8.0.18 and the scheduler did run as a daemon, but an attempt to open a dag failed with the following trace:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.6/dist-packages/flask_admin/base.py", line 69, in inner
return self._run_view(f, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/flask_admin/base.py", line 368, in _run_view
return fn(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/flask_login/utils.py", line 258, in decorated_view
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/www/utils.py", line 384, in view_func
return f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/www/utils.py", line 290, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/db.py", line 74, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/www/views.py", line 1559, in tree
start_date=min_date, end_date=base_date, session=session)
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/db.py", line 70, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/airflow/models/dag.py", line 837, in get_task_instances
tis = tis.order_by(TaskInstance.execution_date).all()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3233, in all
return list(self)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3389, in __iter__
return self._execute_and_instances(context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3414, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 982, in execute
return meth(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 293, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement
distilled_params,
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1250, in _execute_context
e, statement, parameters, cursor, context
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1478, in _handle_dbapi_exception
util.reraise(*exc_info)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 153, in reraise
raise value
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context
cursor, statement, parameters, context
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
cursor.execute(statement, parameters)
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 272, in execute
self._handle_result(result)
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 163, in _handle_result
self._handle_resultset()
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 651, in _handle_resultset
self._rows = self._cnx.get_rows()[0]
File "/home/ubuntu/.local/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 301, in get_rows
else self._cmysql.fetch_row()
SystemError: <built-in method fetch_row of _mysql_connector.MySQL object at 0x3cdaa10> returned a result with an error set
EDIT 2
What finally did work was using mysqlclient by specifying the SQLAlchemy connection string to begin with mysql+mysqldb. I am not giving this as an answer, because the initial problem persists.
VSCode Version: 1.44.0
pytest verison: 4.4.1
Python extension: Python 2020.3.71659
VSCode popup: Test discovery error, please check the configuration settings for the tests.
OUTPUT log as below:
python /Users/eason/.vscode/extensions/ms-python.python-2020.3.71659/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /Users/eason/android_guess_auto -s --cache-clear ./TestCases
Test Discovery failed:
Error: Traceback (most recent call last):
File "/Users/eason/.vscode/extensions/ms-python.python-2020.3.71659/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
main(tool, cmd, subargs, toolargs)
File "/Users/eason/.vscode/extensions/ms-python.python-2020.3.71659/pythonFiles/testing_tools/adapter/__main__.py", line 100, in main
parents, result = run(toolargs, **subargs)
File "/Users/eason/.vscode/extensions/ms-python.python-2020.3.71659/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 30, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 60, in main
config = _prepareconfig(args, plugins)
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 201, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "/Users/eason/test_3env/lib/python3.6/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/eason/test_3env/lib/python3.6/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/eason/test_3env/lib/python3.6/site-packages/pluggy/manager.py", line 87, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/Users/eason/test_3env/lib/python3.6/site-packages/pluggy/callers.py", line 203, in _multicall
gen.send(outcome)
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/helpconfig.py", line 93, in pytest_cmdline_parse
config = outcome.get_result()
File "/Users/eason/test_3env/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/eason/test_3env/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 679, in pytest_cmdline_parse
self.parse(args)
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 896, in parse
self._preparse(args, addopts=addopts)
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 829, in _preparse
self._initini(args)
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 752, in _initini
config=self,
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/findpaths.py", line 122, in determine_setup
rootdir, inifile, inicfg = getcfg([ancestor], config=config)
File "/Users/eason/test_3env/lib/python3.6/site-packages/_pytest/config/findpaths.py", line 35, in getcfg
iniconfig = py.iniconfig.IniConfig(p)
File "/Users/eason/test_3env/lib/python3.6/site-packages/py/_vendored_packages/iniconfig.py", line 54, in __init__
tokens = self._parse(iter(f))
File "/Users/eason/test_3env/lib/python3.6/site-packages/py/_vendored_packages/iniconfig.py", line 82, in _parse
for lineno, line in enumerate(line_iter):
File "/Users/eason/test_3env/bin/../lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 80: ordinal not in range(128)
I have installed Python 3.6 with Anaconda 3.
The installation was successful however, when I launch a notebook, there is
kernel error immediatly with the following error message :
Traceback (most recent call last):
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\notebook\base\handlers.py", line 516, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line
1055, in run
value = future.result()
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\concurrent.py",
line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line
1063, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\notebook\services\sessions\handlers.py", line 75, in post
type=mtype))
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line
1055, in run
value = future.result()
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\concurrent.py",
line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line
1063, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\notebook\services\sessions\sessionmanager.py", line 79, in
create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name,
type, kernel_name)
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line
1055,
in run
value = future.result()
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\concurrent.py",
line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line
1063, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\notebook\services\sessions\sessionmanager.py", line 92, in
start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line
1055, in run
value = future.result()
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\concurrent.py",
line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "C:\Users\Lionel\Anaconda3\lib\site-packages\tornado\gen.py", line 307,
in wrapper
yielded = next(result)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\notebook\services\kernels\kernelmanager.py", line 94, in
start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\jupyter_client\manager.py", line 257, in start_kernel
**kw)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\jupyter_client\manager.py", line 203, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "C:\Users\Lionel\Anaconda3\lib\site-
packages\jupyter_client\launcher.py", line 128, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\Users\Lionel\Anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\Lionel\Anaconda3\lib\subprocess.py", line 997, in
_execute_child
startupinfo)
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
Note that before installing Anaconda 3, I uninstalled Anaconda 2 (with Python 2.7).
How can I fix this?
Finally I found a solution in the web :
I had to execute the following command :
python -m ipykernel install --user
Regards,
Lionel