#๐Ÿ”’ Import libraries throwing error

37 messages ยท Page 1 of 1 (latest)

sterile halo
#

Hello! I'm a beginner and I'm figuring out a way to setup VSCode to work with PySpark applications for Airflow DAGs at work. I created a venv for a project and when I try to install requirements I get:

ERROR: To use truststore feature, 'truststore' must be installed into pip's current environment.

It throws the same error even when I pip install truststore! I've tried the below:

python -m pip install truststore
python -m pip install <package> --use-feature=truststore

I noticed that there is a pip.ini file as below. Copilot says its this use-feature that keeps blocking the installation of the libraries and truststore itself in the venv. I'm able to install truststore outside venv no issues!

[global]
timeout = 60

[install]
use-feature = truststore

It looks like a global file that could affect others and possibly any environment and I really want to avoid making changes in it. lemon_angrysad

mighty knotBOT
#

@sterile halo

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

sand wagon
#

ERROR: To use truststore feature, 'truststore' must be installed into pip's current environment.

Do you understand what an environment refers to here?

I've tried the below:

Exactly how do you try it? How is that related to VSCode?

Did you try using VSCode to do the installation instead?

I created a venv for a project and when I try to install requirements I get:

Exactly how did you create the venv? Exactly how do you try to "install requirements"?

Exactly what does "I get" mean? Where does the error show up?

#

I noticed that there is a pip.ini file as below.

What do you mean by "there is"? Where is it?

sterile halo
#

If you think my question is annoying, feel free to skip. You don't have to be rude. ๐Ÿ™‚

#

I'm only here to learn.

harsh forum
sand wagon
#

Answering questions is an important part of learning.

#

but also to advise a beginner I must know what is already understood and where the difficulty actually remains.

sterile halo
harsh forum
#

Can you copy/paste the full error?

sterile halo
sand wagon
#

So the environment is created via VSCode, and placed where VSCode wants to place environments normally. And you get an error when you try to use pip to install anything in that environment? And you try to use pip by running it from powershell... ? Which copy of pip is it when you do that?

#

(That's fine. Tone really never carries across properly, especially when the intended tone is factual and neutral.)

sterile halo
sand wagon
#

and there's no other output from the command?

sterile halo
sand wagon
#

No, I mean the actual instance of the pip software. In case it needs explaining: you are very likely to have multiple copies of pip installed in different places on your computer.

#

Because pip is designed to work that way by default.

harsh forum
#

But they could be overt:

\path\to\venv\bin\python.exe -m pip  install truststore

and so on, to be sure.

sand wagon
#

does activating the environment in VSCode carry over to its Powershell terminal?

harsh forum
sand wagon
#

I've noticed that the biggest point of commonality with all these "I can't get my environment set up properly" threads is... VSCode.

harsh forum
#

But @sterile halo seems aware of the distinction.
Still a full transcript of a terminal session failing might help.

sand wagon
#

(Well, also pip, but.)

#

Just for what it's worth, upgrading pip will avoid the problem. Newer versions bundle the needed code for the truststore feature.

#

... what Python version are you using? Older versions would put an older Pip into the venv when it's created.

#

(It looks like this was added in 23.3.)

sterile halo
broken hamlet
#

just fyi, vscode sometimes creates a .venv all on its own, so maybe see if there are 2

sand wagon
#

To be clear, python -m pip install --upgrade pip fails, even without asking for truststore โ€” oh, because the pip.ini is asking for it even if you don't.

#

Where exactly is this pip.ini file located, and how did it get there (do you know)?

mighty knotBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.