Custom python packages at Spaces
Hello everyone! I am trying to install custom python package to private repo under Spaces via adding it’s name torequirements.txt, and pushing package code to my HF Spaces repo. This results toERROR: Could not find a version that satisfies the requirement avocado_lite (from versions: none)(it doesn’t surprise me). This package can be installed locally by running commandpip install -e ./avocado_lite. I didn’t find any HF documentation related to this question. So, what should I do, to make my own package be installed under my HF repository environment? Thanks in advance
2022-04-27T15:01:35Z
Can you precompile the wheel and push that instead of the package files? You should be able to direct link from a requirements.txt file to a local wheel, e.g.,./avocado_lite/avocado_lite-4.2.0-py3-none-any.whl
2022-04-27T15:27:15Z
Thanks for a such quick reply, Bram!I’ve tried your solution, but it didn’t work. My filerequirements.txthas the following content:wandb
gradio
./avocado_lite/avocado_lite-1.0.0-py3-none-any.whlAnd I’ve uploaded file under[avocado_lite](https://huggingface.co/spaces/YarrDOpanas/Silverbullet_demo_dashboard/tree/main/avocado_lite)/avocado_lite-1.0.0-py3-none-any.whl, but I am getting anERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/home/user/app/avocado_lite/avocado_lite-1.0.0-py3-none-any.whl'What should I change?
2022-04-27T18:02:33Z
Are you sure the path is correct? You have some round brackets in there that seem out of place. You can also try again with the full (absolute) path. If that does not work, I am not entirely sure how to proceed so hopefully someone else can help you.
2022-04-28T11:15:20Z
Yes, I am sure. I creatednew public repowith dummy sample python package to make sure everyone understand me. Please take a look at an error, atrequirements.txtand my.whlpath. Is everything correct?UPD: can you please provide an example repo where I can see, the custom package was installed correctly?
2022-04-30T22:45:55Z
Well you can run any shell command in python usingos.system(), so perhaps the easiest way might be to replicate you how you installavocado_litelocally.You could add something like this at the top of yourapp.pyfile:import os

os.system('pip install -e ./avocado_lite')

## The rest of your app.py code goes here
2022-05-02T15:49:41Z
Thanks for reply, Abid!The installation error disappeared. But, I can’t use it as package in localhost by just importing it in file. It say’s “no such package”.However, I solved this issue by specifying relative path to package in places where I call functions from it. And I added package requirements torequirements.txtfile under HF repository. Now everything is working.
2022-11-17T12:18:50Z
Hi I am hae a problem with this exact topic. I have the following requirements file-e ./myprimlibmyprimlib is in a subfolder in the hugging face git repoand I get the following error“not a valid editable requirement. It should either be a path to a local project or a VCS URL”
2023-06-13T12:17:23Z
HI, How did exactly you do it?. any example? Thanks