Skip to content
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

PyInt_FromLong not found #1100

Closed
Corfucinas opened this issue Oct 25, 2022 · 16 comments
Closed

PyInt_FromLong not found #1100

Corfucinas opened this issue Oct 25, 2022 · 16 comments
Labels
bug Something isn't working

Comments

@Corfucinas
Copy link

Environment data

  • debugpy version: 1.6.3
  • OS and version: Ubuntu 22.10
  • Kernel: 5.19.0-23-generic
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.11.0 (installed via pyenv)
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Debugger prints constantly PyInt_FromLong not found.

Expected behavior

Debugger to work without this behavior

Steps to reproduce:

  1. Install python 3.11.0
  2. Debug any file (no .vscode/launch.json is required, it will fail with both).
@fabioz
Copy link
Collaborator

fabioz commented Oct 25, 2022

Can you provide the logs when that happens?

See: https://github.com/microsoft/debugpy/wiki/Enable-debugger-logs for details on how to collect the logs.

@Corfucinas
Copy link
Author

Hey @fabioz, here are two files, let me know if this works for you.

debugpy.server-17949.log
debugpy.adapter-17994.log

Here's a screenshot of the console

image

@bcxpro
Copy link

bcxpro commented Oct 26, 2022

I am seeing the same message when I launch a debug task from vscode.

Python 3.11.0 on Ubuntu 20.04 from deadsnake's ppa (on a new vanilla .venv dir installed with python -m venv .venv) and a simple program

print("Hello World!")

my launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "logToFile": true
        }
    ]
}

Console oputput

$  cd /tmp/reprodebugerror ; /usr/bin/env DEBUGPY_LOG_DIR=/home/barce/.vscode-server/extensions/ms-python.python-2022.16.1 /tmp/reprodebugerror/.venv/bin/python /home/barce/.vscode-server/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 34067 -- /tmp/reprodebugerror/hello_world.py 
PyInt_FromLong not found.
PyInt_FromLong not found.
PyInt_FromLong not found.
PyInt_FromLong not found.
PyInt_FromLong not found.
PyInt_FromLong not found.
PyInt_FromLong not found.
PyInt_FromLong not found.
Hello World!
PyInt_FromLong not found.

debugpy.adapter-2555.log
debugpy.launcher-2563.log
debugpy.pydevd.2568.log
debugpy.server-2568.log

@fabioz fabioz added the bug Something isn't working label Oct 26, 2022
@fabioz
Copy link
Collaborator

fabioz commented Oct 26, 2022

Thanks for the logs. I'll be able to investigate this properly tomorrow.

@bcxpro
Copy link

bcxpro commented Oct 26, 2022

If it helps, I just tried the exact same thing on Windows 11, python 3.11.0 installed from the Microsoft Store and it worked OK without any PyInt_FromLong not found message.

debugpy.server-12764.log
debugpy.adapter-38948.log
debugpy.launcher-9620.log
debugpy.pydevd.12764.log

@MarcosRolando
Copy link

Having the same problem here, PopOS 22 with Python 3.11 installed

@alexandr-osprey
Copy link

Same here in pyton dev container. Here is repo, so you could reproduce locally.
https://github.com/alexandr-osprey/linearalgebrastudy

@fabioz
Copy link
Collaborator

fabioz commented Nov 11, 2022

@alexandr-osprey this is already fixed in main.

@ghost
Copy link

ghost commented Nov 14, 2022

The same here, with Fedora and Python 3.9.

@fabioz
Copy link
Collaborator

fabioz commented Nov 15, 2022

@int19h @karthiknadig maybe it'd be good to do another debugpy release and update vscode-python with it as this issue is fixed but anyone trying debugpy on Python 3.11/Linux is bound to hit this issue...

@jdphenix
Copy link

jdphenix commented Nov 19, 2022

If you happen to be using VSCode server with remote extensions, you can workaround this in the meantime. I've done this and it seems to work fine. Obviously, no guarantees.

All commands are executed on the remote system.

  1. Find the VSCode Server lib directory for ms-python.python. On my system, it's at ~/.vscode-server/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python. For saving fingers,

$ export PYLIB_PATH=$HOME/.vscode-server/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python

  1. Clone debugpy.

$ git clone https://github.com/microsoft/debugpy.git ~/.debugpy

  1. Backup the extension's debugpy.

$ tar cf ~/.debugpy.bak.tar $PYLIB_PATH

  1. Copy the debugpy repository code to extension.

$ rm -rf $PYLIB_PATH/debugpy && cp -R ~/.debugpy/src/debugpy $PYLIB_PATH

Obviously this is hacky. Works for me though! Thank you @fabioz!

@nszceta
Copy link

nszceta commented Dec 20, 2022

@jdphenix I made a trivial update to your suggestion. Pasting this block in a Linux terminal on the current VSCode should seamlessly fix the issue in one shot. I'm on Python 3.11.1.

git clone --depth 1 https://github.com/microsoft/debugpy.git ~/.debugpy
rm -rf ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/
mv -v ~/.debugpy/src/debugpy/ ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python
rm -rf ~/.debugpy

Reference: https://adamgradzki.com/visual-studio-code-fix-for-python-311-debugging.html

@jtele2
Copy link

jtele2 commented Jan 4, 2023

@jdphenix I made a trivial update to your suggestion. Pasting this block in a Linux terminal on the current VSCode should seamlessly fix the issue in one shot. I'm on Python 3.11.1.

git clone --depth 1 https://github.com/microsoft/debugpy.git ~/.debugpy
rm -rf ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/
mv -v ~/.debugpy/src/debugpy/ ~/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python
rm -rf ~/.debugpy

Reference: https://adamgradzki.com/visual-studio-code-fix-for-python-311-debugging.html

Had to change the .vscode to .vscode-server. It worked, but now it's telling me to "[Switch] over from ptvsd to debugpy"

@sergei3000
Copy link

I'm still hitting this with Python 3.11 on Linux and with the latest vscode installation

@Corfucinas
Copy link
Author

Same here, no changes since I opened the issue

@bcxpro
Copy link

bcxpro commented Jan 11, 2023

I'm still hitting this with Python 3.11 on Linux and with the latest vscode installation

Check microsoft/vscode-python#20253 (comment)

They are releasing a new vesion of the python extension for VS Code soon. In the mean time, if you switch to the preview version of the python extension, the problem is solved. I tested it yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants