Conda: Changing Python Version. Unusual traceback - python

Tried to change python version from 3.6 to 3.4 to use with tensorflow. I used the conda package manager. I typed
conda install python=3.4.0
When I tried to utilize ipython I got this weird traceback as I was typing my first import statement:
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\interface.py", line 394, in run
self.eventloop.run(self.input, self.create_eventloop_callbacks())
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\eventloop\win32.py", line 87, in run
self._process_queued_calls_from_executor()
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\eventloop\win32.py", line 147, in _process_queued_calls_from_executor
c()
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\interface.py", line 326, in redraw
self._redraw()
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\interface.py", line 351, in _redraw
self.renderer.render(self, self.layout, is_done=self.is_done)
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\renderer.py", line 442, in render
previous_width=(self._last_size.columns if self._last_size else 0))
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\renderer.py", line 153, in _output_screen_diff
current_pos = move_cursor(Point(y=y, x=c))
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\renderer.py", line 90, in move_cursor
_output_cursor_backward(current_x - new.x)
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 256, in cursor_backward
self.cursor_forward(-amount)
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 249, in cursor_forward
sr = self.get_win32_screen_buffer_info().dwCursorPosition
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 150, in get_win32_screen_buffer_info
raise NoConsoleScreenBufferError
prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\Scripts\ipython-script.py", line 5, in <module>
sys.exit(IPython.start_ipython())
File "C:\Program Files\Anaconda3\lib\site-packages\IPython\__init__.py", line 119, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "C:\Program Files\Anaconda3\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Program Files\Anaconda3\lib\site-packages\IPython\terminal\ipapp.py", line 348, in start
self.shell.mainloop()
File "C:\Program Files\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 440, in mainloop
self.interact()
File "C:\Program Files\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 423, in interact
code = self.prompt_for_code()
File "C:\Program Files\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 333, in prompt_for_code
pre_run=self.pre_prompt, reset_current_buffer=True)
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\interface.py", line 404, in run
self._redraw()
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\interface.py", line 351, in _redraw
self.renderer.render(self, self.layout, is_done=self.is_done)
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\renderer.py", line 442, in render
previous_width=(self._last_size.columns if self._last_size else 0))
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\renderer.py", line 119, in _output_screen_diff
current_pos = move_cursor(Point(0, 0))
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\renderer.py", line 90, in move_cursor
_output_cursor_backward(current_x - new.x)
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 256, in cursor_backward
self.cursor_forward(-amount)
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 249, in cursor_forward
sr = self.get_win32_screen_buffer_info().dwCursorPosition
File "C:\Program Files\Anaconda3\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 150, in get_win32_screen_buffer_info
raise NoConsoleScreenBufferError
prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev#scipy.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True
Can't make heads or tails of it. Any help is appreciated.

Related

Miniconda: cannot launch spyder

I have always been able to launch spyder without any issues. But today I started running into the following error messages. I don't understand why is it complaining no workingdir? How do I resolve this, as I cannot even launch spyder ?
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\start.py", line 253, in main
mainwindow.main(options, args)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\mainwindow.py", line 1956, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\utils.py", line 289, in create_window
main.setup()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\mainwindow.py", line 771, in setup
PLUGIN_REGISTRY.register_plugin(self, PluginClass,
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugin_registration\registry.py", line 342, in register_plugin
instance = self._instantiate_spyder5_plugin(
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugin_registration\registry.py", line 193, in _instantiate_spyder5_plugin
plugin_instance.initialize()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugins\new_api.py", line 669, in initialize
self.on_initialize()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\plugin.py", line 82, in on_initialize
container.set_history(
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\container.py", line 323, in set_history
workdir = self._get_init_workdir()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\container.py", line 183, in _get_init_workdir
workdir = self.get_conf('startup/fixed_directory')
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\config\mixins.py", line 76, in get_conf
return CONF.get(section, option, default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\manager.py", line 499, in get
value = config.get(section=section, option=option, default=default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\user.py", line 980, in get
return config.get(section=section, option=option, default=default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\user.py", line 511, in get
raise cp.NoSectionError(section)
configparser.NoSectionError: No section: 'workingdir'

Error with zipfile when installing tensorflow using wheel

Error : ERROR: Exception: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 189, in _main status = self.run(options, args) File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/req_command.py", line 178, in wrapper return func(self, options, args) File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 400, in run pycompile=options.compile, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/init.py", line 88, in install_given_reqs pycompile=pycompile, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_install.py", line 796, in install requested=self.user_supplied, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 827, in install_wheel requested=requested, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 662, in _install_wheel file.save() File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 427, in save with self._zip_file.open(zipinfo) as f: File "/usr/lib/python3.6/zipfile.py", line 1510, in open raise BadZipFile("Bad magic number for file header") zipfile.BadZipFile: Bad magic number for file header
Downloaded Python wheel tensorflow-2.4.1-cp36-cp36-linux_aarch64.whl from https://github.com/Qengineering/TensorFlow-Raspberry-Pi_64-bit

PyCharm's code coverage not working due to Windows drive letters

I have a computer that has a C and D drive, where PyCharm, Python and the source code are installed on the D drive. I'm using Pipenv with PIPENV_VENV_IN_PROJECT set to enabled so that also ends up in the D drive. Despite all this, when running with code coverage enabled, I get this error:
Destroying test database for alias 'default'...
Traceback (most recent call last):
File "D:\Development\PyCharm\PyCharm 2019.1.1\helpers\coverage_runner\run_coverage.py", line 54, in <module>
main()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 770, in main
status = CoverageScript().command_line(argv)
File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 489, in command_line
return self.do_run(options, args)
File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 657, in do_run
self.coverage.save()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\control.py", line 529, in save
data = self.get_data()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\control.py", line 583, in get_data
if self._collector and self._collector.flush_data():
File "D:\Business\projectx\.venv\lib\site-packages\coverage\collector.py", line 425, in flush_data
self.covdata.add_lines(abs_file_dict(self.data))
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 236, in add_lines
self._choose_lines_or_arcs(lines=True)
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 279, in _choose_lines_or_arcs
with self._connect() as con:
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 160, in _connect
self._create_db()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 117, in _create_db
with self._db:
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 525, in __enter__
self.connect()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 510, in connect
filename = os.path.relpath(self.filename)
File "D:\Business\projectx\.venv\lib\ntpath.py", line 562, in relpath
path_drive, start_drive))
ValueError: path is on mount 'C:', start on mount 'D:'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Development\PyCharm\PyCharm 2019.1.1\helpers\coverage_runner\run_coverage.py", line 58, in <module>
main(["xml", "-o", coverage_file + ".xml", "--ignore-errors"])
File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 770, in main
status = CoverageScript().command_line(argv)
File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 511, in command_line
self.coverage.load()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\control.py", line 336, in load
self._data.read()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 409, in read
with self._connect(): # TODO: doesn't look right
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 160, in _connect
self._create_db()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 117, in _create_db
with self._db:
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 525, in __enter__
self.connect()
File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 510, in connect
filename = os.path.relpath(self.filename)
File "D:\Business\projectx\.venv\lib\ntpath.py", line 562, in relpath
path_drive, start_drive))
ValueError: path is on mount 'C:', start on mount 'D:'
Any ideas why?

'Context' object has no attribute 'stdout_capture'

I'm new to python and bdd and need some help, please. I'm trying to get junit reports from python behave, but after each test I got this error:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.4\helpers\pycharm\behave_runner.py", line 271, in <module>
_BehaveRunner(my_config, base_dir).run()
File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.4\helpers\pycharm\_bdd_utils.py", line 96, in run
self._run_tests()
File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.4\helpers\pycharm\behave_runner.py", line 189, in _run_tests
self.__real_runner.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\behave\runner.py", line 672, in run
return self.run_with_paths()
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\behave\runner.py", line 693, in run_with_paths
return self.run_model()
File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.4\helpers\pycharm\behave_runner.py", line 112, in run_model
return super(_RunnerWrapper, self).run_model(features)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\behave\runner.py", line 483, in run_model
failed = feature.run(self)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\behave\model.py", line 523, in run
failed = scenario.run(runner)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\behave\model.py", line 914, in run
self.stdout = runner.context.stdout_capture.getvalue()
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\behave\runner.py", line 214, in __getattr__
raise AttributeError(msg)
AttributeError: 'Context' object has no attribute 'stdout_capture'
By the way flags in behave.ini are next:
[behave]
junit=True
stdout_capture=True
stderr_capture=True
I solve this. If you use ide to run test, as I do (PyCharm), then try to run it from command line and all should work fine.

GAE can't generate discovery file

I upgraded my GAE SDK to Version 1.8.5 and cannot generate a discovery file anymore with endpointscfg.py gen_discovery_doc -o.-f rpc .../main.FlyFlap.APi
I get the errors below.
I tried to delete the file google_appengine/lib/cacerts/urlfetch_cacerts.txt and certs.txt like it is suggested here, but it didn't help. Does someone got same problems?
Traceback (most recent call last):
File "/usr/local/bin/endpointscfg.py", line 196, in <module>
run_file(__file__, globals())
File "/usr/local/bin/endpointscfg.py", line 192, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 472, in <module>
sys.exit(main(sys.argv))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 467, in main
args.callback(args)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 348, in _GenDiscoveryDocCallback
output_path, hostname=hostname)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 188, in GenDiscoveryDoc
service_configs = GenApiConfig(service_class_names, hostname=hostname)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 144, in GenApiConfig
module_name, base_service_class_name = service_class_name.rsplit('.', 1)
ValueError: need more than 1 value to unpack
updated osx and it works again.

Categories

Resources