I am having a lot of issues when uploading a PyPi package, because I have a package that reads information from a TXT file in another directory. This is my project structure:
I can read the files if I do it using my own package from the PyCharm project, but the problem is when I upload it to PyPi and I import is as a pip package.
I read the file in local this way:
tickers = pd.read_csv('../data/tickers.csv')
But that does not work when I install the package using pip.
I have been trying to configure setup.py, but with no succeed, because when I install the package uploaded to PyPi using pip, I get an error like this:
FileNotFoundError: [Errno 2] No such file or directory:
'data/user-agent-list.txt'
This is what I have in my setup.py related to those external files contained in the data/ directory:
I also have a MANIFEST.in to include the data files:
I hope the information I provided is enough for you to let me know how can I fix this... To give you extra information, I am following this tutorial to upload my package to PyPi, but the error has nothing to do with it.
Thank you!
I am wondering if the issue is not related to the path you are using here:
pd.read_csv('../data/tickers.csv')
It refers to the path that is relative to the base execution path of the script that is using your module. Try using a non-relative path. You may also want to use the install path as suggested in this question.
Related
I am using ray library of python but I got an error even if I have the mentioned file.
The error is the following:
FileNotFoundError: Could not find module 'C:\Users\boezi\PycharmProjects\AWSDeepRacerChallenge\env\lib\site-packages\ray_raylet.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
pip did not recognize the library, therefore I downloaded the wheel archive, I extracted it and I put the content in the site-packages folder of my virtual environment.
The package is recognized and I can use automatic filliing with my IDE but I have the aforementioned problem.
I have little experience in Python and want to use this Python library to interface with an API: Python cPanel API library
However, it does not give me any instructions on how to install. I tried pip3 install -e git+https://github.com/vexxhost/python-cpanelapi#egg=cpanelapi gives me the error:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/src/cpanelapi/setup.py'
The repo contains a __init__.py, client.py and exceptions.py file.
How do I use and install this library?
Download the repository.
Move it to the base of your directory (along with your scripts)
Import it with import cpanelapi
I am using Google's Neuroglancer which I downloaded from GitHub and trying to run an example script provided by them. However, one of the lines is import neuroglancer, and since I cloned the whole repo there is a neuroglancer folder with all of the required files, but I am getting the following error:
ImportError: No module named 'neuroglancer'
Is there any way I could fix this? I don't see the issue since neuroglancer is in the same file path as the python script.
In case you are running the example in the neuroglancer project try following their guide.
Otherwise you might want to try and installing the Neuroglancer package using something like pip and a virtual environment to be able to import the package into the project.
I am trying to add SpaCy as a dependency to my Python Lambda. I am doing this by installing SpaCy as a standalone dependency inside a directory named dependencies using pip3 install spacy --no-deps -t . This is because I can't load the entire Spacy dependency inside the \tmp directory of my Lambda.
I am able to successfully upload the folder to s3 and download it during the Lambda invocation. When I try to import spacy, I get this error: [ERROR] Runtime.ImportModuleError: Unable to import module : No module named 'srsly.ujson.ujson'.
I manually installed srsly inside dependencies\ and I have all the files that are listed as per this link. This was referenced by this link. One of the responses says, "it seems like Python can't load it, because it's not compiled?". How would I compile a dependency which has a .c file in it?
One other question which I found on SO is this question, but I have already manually installed srsly. How to I import the module? Thanks.
I manually check in my code for the presence of ujson before importing spacy like this:
if os.path.exists('/tmp/dependencies/srsly/ujson/ujson.c'):
print('ujson exists')
and the print statement gets printed.
For me pip uninstalling and installing srsly again worked fine.. sometimes its just the compatibility issue with your python version so make sure correct python/srsly versions are present
Well it is a bit strange, but my solution for this problem was to create an aditional "ujson" folder in the srsly folder and then move all the ujson generated code to the folder "ujson" previously created
I am using python 2.7.13 and
I am facing problems importing ruamel.yaml when I install it in a custom directory.
**ImportError: No module named ruamel.yaml**
The command used is as follows:
pip install --target=Z:\XYZ\globalpacks ruamel.yaml
I have added this custom directory to PYTHONPATH env variable
and also have a .pth file in this location with the following lines
Z:\XYZ\globalpacks\anotherApp
Z:\XYZ\globalpacks\ruamel
There is another app installed similarly with the above settings
and it works.
What am I missing here?
PS: It works when I install in site-packages folder
also it worked in the custom folder when I created an init.py file
in the ruamel folder.
EDIT:
Since our content creation software uses python 2.7 we are restricted to
using the same.We have chosen to install the same version of python on all
machines and set import paths to to point to modules/apps locacted on shared
network drive.
Like mentioned it works in pythons site-packages but not on the network drive
which is on the PYTHONPATH env-variable.
The ruamel.yaml-**.nspkg.pth and ruamel.ordereddict-*-nspkg.pth are
dutifully installed.Sorry for not giving complete details earlier.Your inputs
are much appreciated.