Python Forum
Installing a python package using pip - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Installing a python package using pip (/thread-28324.html)



Installing a python package using pip - anthonymoss78 - Jul-14-2020

Hi,

This is a continuation of a thread I posted last week .
I have a python package that is a wrapper around some c++ libs with a python interface.
this works absolutely perfectly when you add the location of the pyd to the path and import

I have created a pip install package using distutils.core setup functionality.

The package is created and the tarball is put in the Libs/site-packages location of my python directory.
I then run pip.exe install myPackage.tarball

Pip successfully installs the package . untarring all the files to the directory under libs/site-packages .

If i set my path to that particular directory and import the package into my python script then its all good and i can use the package perfectly.

However, if i open the python environment andjust import ther package.. the package imports perfectly , but i cannot access any of my functions (that i could do when the pyd is part of the path) .

I think it has someting to sdoc with the loader class used to actually install the package .

#this is the script without the pyd location as part of the path
importlib.find_loader('myPackage')

_frozen_importlib_external._NamespaceLoader object at 0x006B7D70>


however, if the package is successfully loaded in the same function call gives .

_frozen_importlib_external.ExtensionFileLoader object at 0x006B7CF0>

So is there a way i can tell pip to is the ExtensionFileLoader instead of the Namespace loader .


any advice here would be great .
thanks