-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running debugger under conda
fails to load _sqlite3
#18828
Comments
@Astlaan, are you able to reproduce the same behaviour if you start code using |
However, what is weird is that commiting in the terminal always worked, even with the pre-commit enabled. The git hook file is the one below: "pre-commit" #!/usr/bin/env bash
# File generated by pre-commit: https://pre-commit.com
# ID: 138fd403232d2ddd5efb44317e38bf03
# start templated
INSTALL_PYTHON='C:\Users\me\Anaconda3\envs\myenv\python.exe'
ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
# end templated
HERE="$(cd "$(dirname "$0")" && pwd)"
ARGS+=(--hook-dir "$HERE" -- "$@")
if [ -x "$INSTALL_PYTHON" ]; then
exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}"
elif command -v pre-commit > /dev/null; then
exec pre-commit "${ARGS[@]}"
else
echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2
exit 1
fi |
The same thing appears to happen when I try to Debug Tests (pytest):
|
@lszomoru any idea on how to solve this without having to deactivate the hook? :) |
Any news? |
@Astlaan, sorry for not getting back to you on this until now. Unfortunately, I am not a python expert, but my suspicion is that this is some kind of a difference between the "environment variables" that are being used by VS Code, and the Terminal given that everything workspace expected in the terminal but not when using VS Code. Is there a mechanism to trace out the the way that python resolves/loads dependencies? |
@brettcannon, could someone from the python provide some guidance given that the error to load |
It's quite possible a side-effect of using a conda environment for running pre-commit. Conda environments typically need to be activated and if the git hook isn't doing that (e.g. via Otherwise I can't debug without more context (e.g. what version of the extension, what was provided on the command-line, etc.). |
Thanks @brettcannon. Based on this comment, it looks like the same error is being shown when the user is trying to debug their tests. That scenario does not involve git at all, and it might have the same root cause. Could we approve the troubleshooting from that angle? Thanks! |
conda
fails to load _sqlite3
Hi @brettcannon . Now the issue I was having got replaced by this error message: This is the console output:
|
That's due to git not finding @lszomoru do you want this moved back to the vscode repo since this more about git and how it executes commands? |
Something I forgot to test was whether the pytest debugger was working, but it seems not: Traceback (most recent call last):
File "C:\Users\me\Anaconda3\envs\project\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\me\Anaconda3\envs\project\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\me\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\Users\me\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\me\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\Users\me\Anaconda3\envs\project\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\me\Anaconda3\envs\project\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\me\Anaconda3\envs\project\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\me\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testlauncher.py", line 44, in <module>
run(cwd, testRunner, args)
File "c:\Users\me\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testlauncher.py", line 36, in run
pytest.main(args)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\_pytest\config\__init__.py", line 143, in main
config = _prepareconfig(args, plugins)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\_pytest\config\__init__.py", line 318, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\pluggy\_callers.py", line 55, in _multicall
gen.send(outcome)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\_pytest\helpconfig.py", line 100, in pytest_cmdline_parse
config: Config = outcome.get_result()
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\pluggy\_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\_pytest\config\__init__.py", line 1003, in pytest_cmdline_parse
self.parse(args)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\_pytest\config\__init__.py", line 1283, in parse
self._preparse(args, addopts=addopts)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\_pytest\config\__init__.py", line 1172, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\pluggy\_manager.py", line 287, in load_setuptools_entrypoints
plugin = ep.load()
File "C:\Users\me\Anaconda3\envs\project\lib\importlib\metadata.py", line 77, in load
module = import_module(match.group('module'))
File "C:\Users\me\Anaconda3\envs\project\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\_pytest\assertion\rewrite.py", line 170, in exec_module
exec(co, module.__dict__)
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\pytest_cov\plugin.py", line 6, in <module>
import coverage
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\coverage\__init__.py", line 15, in <module>
from coverage.control import Coverage, process_startup
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\coverage\control.py", line 21, in <module>
from coverage.data import CoverageData, combine_parallel_data
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\coverage\data.py", line 18, in <module>
from coverage.sqldata import CoverageData
File "C:\Users\me\Anaconda3\envs\project\lib\site-packages\coverage\sqldata.py", line 18, in <module>
import sqlite3
File "C:\Users\me\Anaconda3\envs\project\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "C:\Users\me\Anaconda3\envs\project\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed while importing _sqlite3: The specified module could not be found. To be clear, this happens when I use the following function: |
@Astlaan, sadly there is an issue with We're looking to activate conda environments in a different way with #11039, which should also help solve this issue, closing in favor of that. As a workaround, you can use extension version which predates 2021.12.0 (9 December 2021), where we do not use |
Issue Type: Bug
Hello,
After editing some documents in a repository, staging the changes, adding a commit message, and then trying to commit, I get an error with the following Command output.
I did try importing those same python modules in a python session in a terminal (in the same anaconda environment) and I did not get any issue.
As far as I can tell, this is only happening one of the two workspaces I normally use.
VS Code version: Code 1.63.2 (899d46d82c4c95423fb7e10e68eba52050e30ba3, 2021-12-15T09:40:02.816Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Extensions (15)
A/B Experiments
The text was updated successfully, but these errors were encountered: