5

I have a codebase which needs a specific version of a module. I also have another tool which I use, which uses a different version of the module. I am trying to get these two codebases to play well with eachother.

For example: Codebase A requires foomodule==1.2 and Codebase B requires foomodule==2.0

How do I install Codebase A using pip (so via setup.py) so that it doesn't overwrite foomodule==2.0

setup.py

setup_options = dict(
    install_requires=['foomodule==1.2']

If I go and manually change the name of foomodule folder in dist-packages to foomodule1.2, I can then solve the problem by replacing all occurrences of 'foomodule' in my codebase. But how do I do this programatically during setup.py?

I could potentially Install foomodule into a different location, rename it, and move it to dist-packages. Is there a way to install a required package into a custom location?

Perhaps something like:

setup_options = dict(
    install_requires=[('foomodule==1.2', location_of_install)]
)

setup(**setup_options)

new_location = os.join(distutils.sysconfig.get_python_lib(), 'foomodule1.2')
shutil.copyfile(location_of_install, new_location)
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.