Skip to content

Cannot load AP-HP/eds-pseudo-public because of pip path in my venv #18

@ylaizet

Description

@ylaizet

Hi, Following the readme instructions, I get an error when loading the model.

Description

I created a python virtualenv and installed the lib, registered to hugging face and got a read token. Everything is good until I load the model with:

nlp = edsnlp.load("AP-HP/eds-pseudo-public", auto_update=True)

I get the following error:

In [7]: nlp = edsnlp.load("AP-HP/eds-pseudo-public", auto_update=True)
Fetching 36 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 36/36 [00:00<00:00, 4348.81it/s]
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File ~/.virtualenvs/edsnlp/lib/python3.12/site-packages/edsnlp/core/pipeline.py:1222, in load(model, overrides, exclude, disable, enable, auto_update, install_dependencies, **kwargs)
   1221 try:
-> 1222     return load_from_huggingface(
   1223         model,
   1224         overrides=overrides,
   1225         auto_update=auto_update,
   1226         install_dependencies=install_dependencies,
   1227         **kwargs,
   1228     )
   1229 except (
   1230     ImportError,
   1231     requests.RequestException,
   1232     ValueError,
   1233     FileNotFoundError,
   1234 ) as e:

File ~/.virtualenvs/edsnlp/lib/python3.12/site-packages/edsnlp/core/pipeline.py:1312, in load_from_huggingface(repo_id, auto_update, install_dependencies, token, revision, **kwargs)
   1309 if should_install or not any(
   1310     p.startswith(module_name) and p.endswith(".dist-info") for p in os.listdir(path)
   1311 ):
-> 1312     subprocess.run(
   1313         [pip, "install", "-e", path, "--target", path, "--no-deps", "--upgrade"]
   1314     )
   1316 if path not in sys.path:

File /usr/lib/python3.12/subprocess.py:548, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    546     kwargs['stderr'] = PIPE
--> 548 with Popen(*popenargs, **kwargs) as process:
    549     try:

File /usr/lib/python3.12/subprocess.py:1026, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)
   1023             self.stderr = io.TextIOWrapper(self.stderr,
   1024                     encoding=encoding, errors=errors)
-> 1026     self._execute_child(args, executable, preexec_fn, close_fds,
   1027                         pass_fds, cwd, env,
   1028                         startupinfo, creationflags, shell,
   1029                         p2cread, p2cwrite,
   1030                         c2pread, c2pwrite,
   1031                         errread, errwrite,
   1032                         restore_signals,
   1033                         gid, gids, uid, umask,
   1034                         start_new_session, process_group)
   1035 except:
   1036     # Cleanup if the child failed starting.

File /usr/lib/python3.12/subprocess.py:1955, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session, process_group)
   1954 if err_filename is not None:
-> 1955     raise child_exception_type(errno_num, err_msg, err_filename)
   1956 else:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/pip'

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
Cell In[7], line 1
----> 1 nlp = edsnlp.load("AP-HP/eds-pseudo-public", auto_update=True)

File ~/.virtualenvs/edsnlp/lib/python3.12/site-packages/confit/registry.py:340, in validate_arguments.<locals>.validate.<locals>.wrapper_function(*args, **kwargs)
    338     e.__cause__ = None
    339     e.__suppress_context__ = True
--> 340 raise e.with_traceback(remove_lib_from_traceback(e.__traceback__))

File ~/.virtualenvs/edsnlp/lib/python3.12/site-packages/pydantic/deprecated/decorator.py:227, in ValidatedFunction.execute(self, m)
    225     return self.raw_function(*args_, **kwargs, **var_kwargs)
    226 else:
--> 227     return self.raw_function(**d, **var_kwargs)

File ~/.virtualenvs/edsnlp/lib/python3.12/site-packages/edsnlp/core/pipeline.py:1238, in load(model, overrides, exclude, disable, enable, auto_update, install_dependencies, **kwargs)
   1235             base_exc = e
   1237 if not isinstance(model, Config):
-> 1238     raise ValueError(error) from base_exc
   1240 return Pipeline.from_config(model)

ValueError: The load function expects either :
- a confit Config object
- the path of a config file (.cfg file)
- the path of a trained model
- the name of an installed pipeline package
- or a model on the huggingface hub if edsnlp[ml] has been installed
but got 'AP-HP/eds-pseudo-public' which is neither

How to reproduce the bug

I have create a venv then,

I strictly followed the instructions form the readme until step 5.

The error comes from the pip path used which points to '/usr/local/bin/pip' whereas mine is in my virtualenv.
To check this, I have symlinked my venv pip file into '/usr/local/bin/pip' and it worked.
Using pip without path should do the trick.

Your Environment

venv created to install the libraries.

  • Operating System:
  • Python Version Used: 3.12.3
  • EDS-Pseudo Version Used: edsnlp==0.16.0
  • Environment Information: ubuntu 24.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions