Pycharm debugging failing

已回答

I am running PyCharm CE on Ubuntu 18.04 with Anaconda interpreter.

When I try to debug my code clicking on Debug, I get the following error in debug window:

from _pydevd_bundle.pydevd_comm import get_global_debugger
Traceback (most recent call last):
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 2, in <module>
from _pydevd_bundle_ext.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo, global_cache_skips, global_cache_frame_skips
ModuleNotFoundError: No module named '_pydevd_bundle_ext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info.py", line 17, in <module>
from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 32, in <module>
mod = __import__(check_name)
ModuleNotFoundError: No module named '_pydevd_bundle.pydevd_cython_linux_37_64'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 2, in <module>
from code import InteractiveConsole
ImportError: cannot import name 'InteractiveConsole' from 'code' (/home/user/Honeybadger/Projects/book_recsys_1_hour/code.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/snap/pycharm-community/128/helpers/pydev/pydevd.py", line 28, in <module>
from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info.py", line 19, in <module>
from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # @UnusedImport
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info_regular.py", line 7, in <module>
from _pydevd_bundle.pydevd_frame import PyDBFrame
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_frame.py", line 10, in <module>
from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_breakpoints.py", line 16, in <module>
from _pydevd_bundle.pydevd_comm import get_global_debugger
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 80, in <module>
from _pydevd_bundle import pydevd_console_integration
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 4, in <module>
from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
File "/snap/pycharm-community/128/helpers/pydev/_pydevd_bundle/pydevconsole_code_for_ironpython.py", line 305
exec code in self.locals
^
SyntaxError: Missing parentheses in call to 'exec'

 

I get the message:

Connection to Python Debugger failed. Socket closed.

 

Following is the code I am using:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

books = pd.read_csv('BX-Books.csv', sep=';', error_bad_lines=False, encoding="latin-1")
books.columns = ['ISBN', 'bookTitle', 'bookAuthor', 'yearOfPublication',
'publisher', 'imageUrlS', 'imageUrlM', 'imageUrlL']

users = pd.read_csv('BX-Users.csv', sep=";", error_bad_lines=False, encoding="latin-1")
users.columns = ['userId', 'location', 'age']

ratings = pd.read_csv('BX-Book-Ratings.csv', sep=';', error_bad_lines=False, encoding="latin-1")
ratings.columns = ['userId', 'ISBN', 'bookRating']

print(ratings.shape)
print(ratings.columns)

print(ratings.head())

plt.rc("font", size=15)
ratings.bookRating.value_counts(sort=False).plot(kind='bar')
plt.title('Ratings Distribution')
plt.xlabel('Rating')
plt.ylabel('Count')
plt.show()

print(users.shape)
print(users.columns)

print(users.head)

users.age.hist(bins= [10, 20, 30, 40, 50, 60, 70, 80, 90, 100])
plt.title("Age Distribution")
plt.xlabel('Age')
plt.ylabel('Count')
plt.show()

ratings_count = pd.DataFrame(ratings.groupby('ISBN')['bookRating'].count())
print(ratings_count.sort_values('bookRating', ascending=False).head())

most_rated_books = pd.DataFrame(['0971880107', '0316666343', '0385504209', '0060928336', '0312195516'],
index=np.arange(5), columns=['ISBN'])
most_rated_books_summary = pd.merge(most_rated_books, books, on='ISBN')
print(most_rated_books_summary)


0

Hi,

What is your PyCharm version? Please make sure to use the latest one.

If the issue remains in the latest PyCharm version, try this workaround https://youtrack.jetbrains.com/issue/PY-33197#focus=streamItem-27-3240476.0-0

0
Avatar
Permanently deleted user

I am using 2019.1.2. I downloaded the latest version.

I tried the workaround you gave, it is still not working.

I tries another project with default python interpreter. Its working fine. May be some change of setting for Anaconda?

0

So it works fine if you are using non-conda project interpreter, right?

We have a bunch of conda-related fixes in 2019.1.3, could you please try how it goes in 2019.1.3 RC build? You can download it from https://confluence.jetbrains.com/pages/viewpage.action?pageId=23004355 or with help of Toolbox App.

0
Avatar
Permanently deleted user

I had the same issue and it turned out to be a conflict with my own python module called 'code' and one in use by the debugger. I changed my module name and the debugger began working. This article pointed me to the solution: https://superuser.com/questions/1385995/my-pycharm-run-is-working-but-debugging-is-failing

10
Avatar
Permanently deleted user

I can confirm Mohamed information... thanks !!

0

I had a similar issue while debugging on using an SSH interpreter and it wasn't due a DIR called 'code', but rather it was caused by Cython's usage during a debug call. Adding PYDEVD_USE_CYTHON=NO to the environment variable of the configuration fixed the issue for me.

1

请先登录再写评论。