The issue: I ran pip install pyshp, but could not import it into my python project. When I check the package in my site-packages folder, I see it installed as 'pyshp-2.1.0.dist-info'. When I look at what's inside that folder, I only see the following files: INSTALLER, LICENSE.txt, METADATA, RECORD, REQUESTED, top_level.txt, and WHEEL. I don't see a single .py file. When I download the package manually from the pyshp download page, the folder has a bunch of other files, including the shapefile.py file that I need. So it seems like the download is getting stuck somehow. I've also tested and encountered this same issue with Pillow and Matplotlib, so I think it's something with my Python setup, not an issue with the package itself.
I'm fairly new to Python, does anyone know what I've done wrong? Or any other ideas? Thanks for your help in advance.
Edit: To be clear, I'm not trying to fix the pyshp install issue directly, but instead figure out why the install process isn't working for all of the packages I'm trying to install.
Go to your site packages directory, it is in the root of the site packages directory. So copy and place it in the same directory beside your python script, and you can import shapefile
Related
This is the first time I'm writing a prioprietary, local library so I'm totally new in this matter. I've been looking for a proper solution but maybe I'm missing something. Anyway...
The main code is in some non-Python folder. I install this package in three steps:
First (excluding the last one substep)
Second (py setup.py build)
py setup.py install
I'm using this method because when I tried pip it didn't work for me.
Because it's a new package I still make many changes. After installation, I do it in the source code in site-packages Python folder.
My question is - how to reverse this process of installation in order to save source code files to a selected, non-Python folder? I prefer to avoid manually copying files or using pip uninstall and yet repeating the process described above to install package after editing the code.
In other words I would love to work on my package locally and automatically update it in site-packages OR the other way round.
I will be grateful for any response.
Python version I'm writing in - 3.10.1. IDE - VSC.
In short, my question is, how do I install the latest version of scikit-image into my usr/lib/python3/dist-packages so I can actually use it? I think there is a problem with my understanding of how third-party modules are installed. As a newb, I don’t know how to rectify that, hence this post.
I need help to understand how to install packages in python3 up until now I have used pip/pip3/apt-get/synaptic etc and it has worked fine for many packages. However, I have hit several barriers (Skimage, opencv, plantcv in python3). I must emphasise, the problem I am having is using these packages in python3, not 2.7.
For example, I want to use the latest version of scikit-image (0.14) with python3. (http://scikit-image.org/) I have tried using the installation instructions and have not yet successfully managed to install it. I have navigated to my usr/lib/python3/dist-packages and copied scikit-image into this directory (I have all the dependencies installed in here already).
Image of my folder for dist-packages as proof
As you can see, the folder containing skimage is in the directory I want to be installed in, how do I actually install it? Do I have to extract skimage out of the folder into the directory and then run the install command? If I navigate to usr/lib/python3/dist-packages/scikit-image and then run pip install -e . I get an error, stating that I need numpy. If I write a python script using python3 I can clearly see I have it installed (and I have been using it for a long time). So, there must be a problem in how I have this package in my file system. I think a janky workaround would be to copy all the modules into my working directory and Import them that way as if they were modules I have made myself, but this obviously negates the whole point of installing packages.
This has also happened with another package called plantcv. Where I went into the directory usr/lib/python3/dist-packages then cloned the source from git hub and installed as per instructions. When I import plantcv in my python3 script. It Imports fine. But, there is nothing in it, as python cannot see the modules which are inside this folder at usr/lib/python3/dist-packages/plantcv/plantcv.
There is clearly some comprehension here that I am missing, as I have a similar problem for two packages now. Please, Internet. Help me understand what I am missing!
You simply need to copy the folder in /usr/lib/python3/dist-packages/package-name
However, there are certain things that are specific to python packages. The folder named package name should be a valid package. A good indicator of that is it will contain a file "__init__.py". It is very likely that every sub-directory inside this package directory will contain a "__init__.py" file. It depends on whether there are modules inside these sub-directories.
In your code simply import the package like the following.
import package-name
where package-name can be skimage
Overall I'm trying to use a module in Django that helps with translating pages, but I don't have installed and can't do it through pip install package.
I've tried the fllowing:
pip install gettext
That returns that could not find a version that requires the...
I also downloaded the tar.gz file from the official website, yet when I try to install it localy the error:
python setup.py egg_info failed with error code 1 windows
Comes up. Been reading, trying to fix the second error or possible solutions, installed ez_update, updatade all packages, made a rollback and I don't know what to do anymore, any help?
The package gettext is available as python-gettext in Python pypi
Please use
pip install python-gettext
I was struggling with the same issue and what worked for me eventually is the following:
download gettext-runtime-0.17.zip and gettext-tools-0.17.zip (or the latest version) from here:
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
Place both directories in your project directory (say myProject)
Now, in each of these folders there is a bin folder. Go into it and copy the address. Each would look sth like:
C:\myProject\gettext-runtime-0.17\bin
C:\myProject\gettext-tools-0.17\bin
Go into: control panel > System > Advanced System settings > Environment variables. In system variables, choose Path and click
'edit'.
Paste both addresses at the end, like this:
;C:\myProject\gettext-runtime-0.17\bin;C:\myProject\gettext-tools-0.17\bin
(don't forget the semicolon after the last existing item)
Activate your virtualenv and run the makemessages command. It should work.
I've followed the methods shown over here and here to install opencv from source. But despite following it step by step, cv2.pyd is not generated. The reason I'm building from source is because I need to apply a patch in matchers.cpp before building it, which I cannot do if I install from an executable.
I have faced the same problem. And I dont know the reason why it is not being generated. But, the workaround is using the .whl (wheel) file to install the built libraries. So once you have built using Visual Studio, just download the corresponding wheel file from here and then,
go to that location from cmd(Run as administrator)
run pip install (whl file)
Example : pip install opencv_python-3.2.0+contrib-cp36-cp36m-win32.whl
Thats it. You should see the files in site-packages inside Python/Lib/.
What the whl file does is just move the files to the site packages. It somehow creates the cv2.pyd as well. If someone can explain in depth how that works it will be really helpful!
Hopefully, this works for you.
I'm trying to install a package, pybrain, from its github website. It does not have nicely packaged archive files or executables, so I don't know how to install it via WPPM.
Do I still do python setup.py install, or do I copy the pybrain folder manually to the site-packages? I figured one thing I can do is to
python setup.py sdist
to generate an archive file, and then use WPPM to do it. Is this the "best" way?
Thanks in advance!
PS: Sorry that I don't have enough reputation to initiate the tag of "WinPython".
Most packages that are configured properly with distutils will automatically place themselves in the correct location with "python setup.py install"
Having had similar issues, especially sitting behind a corporate firewall, I found the easiest way to install things from github repositories is to download the repository as a zip file, then use the WPPM to add the package from there. Github repositories give the option of downloading as a zip on the right hand side. I've found that the package manager handles everything correctly from there.