Skip to content

multiprocess doesn't honor modified sys.path and fails with ModuleNotFoundError: No module named 'multiprocess' #107

Open

Description

@jiasli

We use pip install --target to install pathos, multiprocess and other dependencies into a custom location and import multiprocess after modifying sys.path:

import sys

sys.path.append(r'C:\Users\name\.azure\cliextensions\confcom')

import multiprocess
m = multiprocess.Manager()

(The actual code is https://github.com/Azure/azure-cli/blob/2e87ac82207b345be80aa7051cabf5071f1b94dd/src/azure-cli-core/azure/cli/core/extension/operations.py#L498)

This causes failure:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'multiprocess'

This issue only happens on Windows, not Linux.

Is this a supported use case? If not, what is the best way to let multiprocess honor modified sys.path. Thanks a lot for the help.

Activity

  1. mmckerns commented on Jan 29, 2023

    @mmckerns
    Member

    Sorry this was ignored for so long. I'm not sure what you are asking. It seems that you are using an install to a custom location... and if that location is not on the python path, I'd expect that the module would not be found. The standard way to address that is either to alter the python path environment variable (outside of python) or to modify the sys.path variable while using python. If that's not what you are asking, and it's still relevant for you, please clarify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions