Unable to import langchain in python

Hi all,

I have been trying to import langchain package but I keep getting the error. Any idea how to import it properly?


Hello @SimonK8! Please try installing that package through the packager, or in the shell with pip install langchain.
Lemme know if this helps!


Thanks, it helped, thought it was available by default!

Happy to help! If my post solved you problem, please mark it as the solution.

The default Python repl template uses poetry so pip install langchain might not cut it, you might need to do poetry add langchain.

1 Like

I am having the same issue. Pip install lanchain in shell produces an error. This is a new python repl, but I don’t have this with other repls.

Is there an issue with the new repl?

try using the packager

No, most of the custom module in pypi is not available when you start a new repl to save run time and storage. Your storage will certainly max out many times if your repl got everything included by default.

Also people might post malware pypi which may be deleted after a short time but you may accidentally install it if you got everything, so if it says import fail, it’s not repl’s problem you just need to do


1 Like

If you are absolutely sure that langchain exists exactly as you typed it, but it shows as “package not found” in the shell, then you might be able to solve this problem by editing .config/pypi/pypi.conf like the following file

Thanks all for the help. It was an issue with the nix file. I don’t know why because it was a standard repl python template—odd. I fixed it by copying and pasting the nix file from another repl, which worked.