I'm trying to convert a Jupyter notebook into a PDF file but I keep getting the following error:
[NbConvertApp] Converting notebook ejercicios.ipynb to pdf
Traceback (most recent call last):
...
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\exporters\exporter.py", line 143, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\exporters\exporter.py", line 318, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\preprocessors\base.py", line 47, in __call__
return self.preprocess(nb, resources)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\preprocessors\base.py", line 69, in preprocess
nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\preprocessors\convertfigures.py", line 45, in preprocess_cell
output.data[self.to_format] = self.convert_figure(
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 125, in convert_figure
shell = self.command.format(from_filename=input_filename,
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 575, in __get__
return self.get(obj, cls)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 538, in get
default = obj.trait_defaults(self.name)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 1578, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 975, in __call__
return self.func(*args, **kwargs)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 77, in _command_default
major_verison = self.inkscape_version.split('.')[0]
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 575, in __get__
return self.get(obj, cls)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 538, in get
default = obj.trait_defaults(self.name)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 1578, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\traitlets\traitlets.py", line 975, in __call__
return self.func(*args, **kwargs)
File "c:\users\netoo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 57, in _inkscape_version_default
p = subprocess.Popen([self.inkscape, '--version'],
File "c:\users\netoo\appdata\local\programs\python\python38\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\users\netoo\appdata\local\programs\python\python38\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Acceso denegado
Looks like the default permissions for that command aren't enough to create a process of Inkscape, but I'm already using the command line with administrator privileges.
I was able to convert a notebook to PDF successfully past year, it's the same machine but I was using another version of Python, 3.6 or 3.7, does that have to do to with this?
I reported this issue here https://github.com/jupyter/nbconvert/issues/1525
My temporary solution was to use the absolute path as a string literal where I installed Inkscape instead of calling self.inkscape, in my case the path is 'C:\\Program Files\\Inkscape\\inkscape.exe':
https://github.com/jupyter/nbconvert/blob/88baf7a9ca724d74c9f890a60d5c3680e8959a14/nbconvert/preprocessors/svg2pdf.py#L57
in that line I have p = subprocess.Popen(['C:\\Program Files\\Inkscape\\inkscape.exe', '--version'].
I printed self.inkscape and the output was 'C:\Program Files\Inkscape\inkscape.exe'. I thought it was because of the double back slash so I tried os.path.abspath(self.inkscape) but it was adding the current path from where I'm calling the command at the beginning. I also tried pathlib.Path(self.inkscape) but it didn't work, so I have no idea what the problem could be.
Related
I'm using Guesslangtools on my Mac in order to create a dataset.
When the execution reaches the step "Download chosen repositories" I'm hitting the following error:
Could this error be in any way related to Python 9?
I would appreciate suggestions on how to fix this.
"""
Traceback (most recent call last):
File "/usr/local/Cellar/python#3.9/3.9.13/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/local/lib/python3.9/site-packages/guesslangtools/common.py", line 264, in _apply
return method(item, *other_args, **keywords)
File "/usr/local/lib/python3.9/site-packages/guesslangtools/workflow/github_repositories.py", line 130, in _clone_repository
result = run(command, stdout=PIPE, stderr=PIPE)
File "/usr/local/Cellar/python#3.9/3.9.13/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/Cellar/python#3.9/3.9.13/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/Cellar/python#3.9/3.9.13/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'timeout'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/gltool", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/guesslangtools/__main__.py", line 153, in main
run_workflow(config)
File "/usr/local/lib/python3.9/site-packages/guesslangtools/app.py", line 15, in run_workflow
github_repositories.download(config)
File "/usr/local/lib/python3.9/site-packages/guesslangtools/common.py", line 175, in wrapped
result = func(config, *args, **kw)
File "/usr/local/lib/python3.9/site-packages/guesslangtools/workflow/github_repositories.py", line 105, in download
for step, row in enumerate(pool_map(_clone_repository, rows, config), 1):
File "/usr/local/lib/python3.9/site-packages/guesslangtools/common.py", line 255, in pool_map
for result in pool.imap_unordered(_apply, iterable):
File "/usr/local/Cellar/python#3.9/3.9.13/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
FileNotFoundError: [Errno 2] No such file or directory: 'timeout'```
it’s likely because the GNU timeout program does not exist on the system that is running the test. timeout is part of the GNU Coreutils, so make sure that is installed on the system.
$ brew install coreutils # Mac OS X
then add a "gnubin" directory to your PATH, for example:
$ export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
I have done the training with sklearn model along with mlflow and it generated the mlruns folder.
When I try to run mlflow ui it throws the following error.
There is bug in Git https://github.com/mlflow/mlflow/issues/1670 but doesn't have any solution.
Have anyone faced and have any work around for this ?
Tried re-installation.
Attaching the traces below.
Traceback (most recent call last):
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Vivek.ananthan\Anaconda3\envs\deepcpu\Scripts\mlflow.exe\__main__.py", line 7, in <module>
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\click\core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\click\core.py", line 1062, in main
rv = self.invoke(ctx)
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\click\core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\click\core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\mlflow\cli.py", line 280, in ui
_run_server(backend_store_uri, default_artifact_root, host, port, None, 1)
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\mlflow\server\__init__.py", line 138, in _run_server
exec_cmd(full_command, env=env_map, stream_output=True)
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\site-packages\mlflow\utils\process.py", line 34, in exec_cmd
child = subprocess.Popen(
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\users\vivek.ananthan\anaconda3\envs\deepcpu\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
This question already has answers here:
pipenv Failing to Install Packages
(3 answers)
Closed 1 year ago.
I have already installed python's latest version and pipenv on Windows Powershell. When I try to install requests it is showing this error:
FileNotFoundError: [WinError 2] The system cannot find the file specified
ValueError: Not a valid python path: 'C:/ProgramData/Anaconda3/python.exe'
Full error code:
Traceback (most recent call last):
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 618, in parse_executable
result_version = get_python_version(path)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\utils.py", line 105, in get_python_version
c = subprocess.Popen(version_cmd, **subprocess_kwargs)
File "c:\python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\python39\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:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python39\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\python39\lib\site-packages\pipenv\cli\command.py", line 233, in install
retcode = do_install(
File "c:\python39\lib\site-packages\pipenv\core.py", line 1920, in do_install
ensure_project(
File "c:\python39\lib\site-packages\pipenv\core.py", line 576, in ensure_project
ensure_virtualenv(
File "c:\python39\lib\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "c:\python39\lib\site-packages\pipenv\core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "c:\python39\lib\site-packages\pipenv\core.py", line 350, in find_a_system_python
return next(iter(finder.find_all_python_versions()), None)
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 312, in find_all_python_versions
python_version_dict = getattr(self.system_path, "python_version_dict", {})
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 120, in system_path
self._system_path = self.create_system_path()
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 82, in create_system_path
return pyfinder_path.SystemPath.create(
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 682, in create
instance = instance._run_setup()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 233, in _run_setup
new_instance = new_instance._setup_windows()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 411, in _setup_windows
windows_finder = WindowsFinder.create()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 146, in create
return cls()
File "<attrs generated init pythonfinder.models.windows.WindowsFinder>", line 13, in __init__
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 113, in get_versions
versions[py_version.version_tuple[:5]] = base_dir
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 365, in __getattribute__
result = super(PythonVersion, self).__getattribute__(key)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 430, in version_tuple
self.patch,
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 375, in __getattribute__
instance_dict = self.parse_executable(executable)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 620, in parse_executable
raise ValueError("Not a valid python path: %r" % path)
ValueError: Not a valid python path: 'C:/ProgramData/Anaconda3/python.exe'
It seems like you have two different Python distributions installed on your system: the Python 3.9 in C:\Python39\ and the Anaconda Python in C:/ProgramData/Anaconda3/. There is a conflict between them.
I recommend that you use one of them only - the Anaconda or the official Python, and uninstall another.
I am developing a small usb application using python (pyUSB) under Win 10 and have the following problem.
When I test basic commands under the python console, everything works fine. I can open the device, write bytes to it and read from it.
Next, I am trying to put it all in one tkinter app and debug it using VSCode. Here I keep getting the following error:
File "c:\Test\usbtester\main.py", line 198, in usb_open
self.dev.set_configuration()
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 869, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 147, in managed_set_configuration
self.managed_open()
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 120, in managed_open
self.handle = self.backend.open_device(self.dev)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\backend\libusb1.py", line 787, in open_device
return _DeviceHandle(dev)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\backend\libusb1.py", line 644, in __init__
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\backend\libusb1.py", line 596, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
Can someone suggest what I could be doing wrong here?
I'm currently trying to transfer a file as a Celery Task on Django from local disk to another machine via UNC path and I've run into quite a few road blocks.
I've used a package called win_unc which works fine in an independent script. However when I use the same code as a celery task, I run into the following error:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\celery\task\trace.py", line 228, in trace_task
R = retval = fun(*args, **kwargs)
File "C:\Python27\lib\site-packages\celery\task\trace.py", line 415, in __protected_call__
return self.run(*args, **kwargs)
File "Path\to\file\file.py", line 96, in movefile
conn.mount()
File "C:\Python27\lib\site-packages\win_unc\connecting.py", line 163, in mount
self.connect()
File "C:\Python27\lib\site-packages\win_unc\connecting.py", line 63, in connect
self._connect_with_creds(self.get_username(), self.get_password())
File "C:\Python27\lib\site-packages\win_unc\connecting.py", line 118, in _connect_with_creds
run(command)
File "C:\Python27\lib\site-packages\win_unc\internal\shell.py", line 29, in run
raise ShellCommandError(command, process.returncode)
ShellCommandError: The command `NET USE "Y:" "\\UNC\path" /PERSISTENT:NO` exited with error code 2.
The other modules I used to move the file were os and shutil.
I used shutil to copy the file over to the UNC destination and got the following error:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\celery\task\trace.py", line 228, in trace_task
R = retval = fun(*args, **kwargs)
File "C:\Python27\lib\site-packages\celery\task\trace.py", line 415, in __protected_call__
return self.run(*args, **kwargs)
File "Path\to\file\file.py", line 96, in movefile
shutil.copy(source.strip(), dest.strip())
File "C:\Python27\lib\shutil.py", line 117, in copy
copyfile(src, dst)
File "C:\Python27\lib\shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 22] invalid mode ('wb') or filename: '\\\\UNC\\path\\somefile.csv'
This was error with os.rename
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\celery\task\trace.py", line 228, in trace_task
R = retval = fun(*args, **kwargs)
File "C:\Python27\lib\site-packages\celery\task\trace.py", line 415, in __protected_call__
return self.run(*args, **kwargs)
File "Path\to\file\file.py", line 95, in movefile
os.rename(source, dest)
WindowsError: [Error 1326] Logon failure: unknown user name or bad password
All of the above work fine when I use an independent python script to move the file. This also works from the python command line. I don't understand why it fails as a Celery task or if there is any other reason.
I use Python 2.7.3 and Django 1.4.2.
I'd really appreciate any help with this.