pick icon indicating copy to clipboard operation
pick copied to clipboard

ModuleNotFoundError: No module named 'pick'

Open ahyou-mug opened this issue 6 months ago • 2 comments

Have just installed pick in a python3 env using pip install pick and I get the following error:

Import Code:

import json
import pick

Also the same error using code from the StackOverflow example

import json
from pick import pick

Error output:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 2
      1 import json
----> 2 import pick

ModuleNotFoundError: No module named 'pick'

Screen shot proving install:

Image

Not sure how to proceed or what could be causing the issue. It seems that even though the library is installed in the environment it still won't import

ahyou-mug avatar May 31 '25 23:05 ahyou-mug

Ok.. So I moved pick from site-packages to Python and then back again. I closed the environment and reloaded it. pick now works in a live python3 environment but still won't import to jupyter-notebook

Screenshot of live terminal

Image

ahyou-mug avatar Jun 01 '25 00:06 ahyou-mug

Have pick working now. It seems that it only works from the same directory as the working directory of your current project: eg: ~/../../../Geneaology/pick/__init__.py

It doesn't work form the lib/python3.12/site-packages directory in the environment

For anyone who encounters the same challenges simply add the following lines to your script and then comment out after the first run:

# install pick, comment out after first run
!pip install pick

# Example code from pick repo
from pick import pick

title = 'Please choose your favorite programming language: '
options = ['Java', 'JavaScript', 'Python', 'PHP', 'C++', 'Erlang', 'Haskell']

option, index = pick(options, title, indicator='=>', default_index=2)

Note: working in Jupyter. Assuming it's the same in Conda

ahyou-mug avatar Jun 01 '25 00:06 ahyou-mug

I think this is related to how to use Python with package manager, not pick package it self.

aisk avatar Oct 05 '25 12:10 aisk