Skip to content
Advertisement

pipx-installed Spyder doesn’t recognize Poetry-installed pandas only when trying to view DataFrame in Variable Explorer

I’m using Python 3.8.5. My OS is Kubuntu 18.04.

I installed Spyder and Poetry via pipx:

JavaScript

Within my project folder, I installed pandas and spyder-kernels as dependencies:

JavaScript

I can open Spyder just fine:

JavaScript

In Spyder -> Preferences -> Python interpreter, I added the path to the Python interpreter for the project’s Poetry environment. I can import pandas in Spyder, like normal.

However, when I create a DataFrame (by reading an Excel file) in Spyder and try to double-click this DataFrame in the Variable Explorer, I get the following error message:

enter image description here

For those internet searching, it reads, “Spyder is unable to show the dataframe … because pandas was not installed alongside Spyder.”

In Spyder > Help > Dependencies, I confirm that pandas is listed as not installed:

JavaScript

How can I get pandas installed in a place where my pipx-installed Spyder will recognize it? Apparently, it doesn’t recognize the Poetry-installed pandas.

I tried installing pandas with pipx:

JavaScript

Didn’t work.

I tried running Spyder in a Poetry shell within the project folder:

JavaScript

Didn’t work.

Advertisement

Answer

The problem seems to be that you installed spyder or its kernels on --dev and pandas as a general dependency.

As a test I created a new poetry environment and ran this:

JavaScript

And then ran spyder with poetry run spyder and worked like a charm, spyder recognizes pandas without any issues.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement