Perplexing Python Package Predicament - python

First of all, I am running Python 2.7.5 on a Mac. I am trying to install a package and can't get it to work despite different approaches. The package is called python-fs-stack and is available here. https://pypi.python.org/pypi/python-fs-stack. I tried pip install python-fs-stack, sudo pip install python-fs-stack, easy_install python-fs-stack, sudo easy_install python-fs-stack and nothing worked. I then downloaded the package and got an error about a README.rst not being found. I commented out this line in the setup.py file and re-ran it. It got a lot farther, but then there was another error. Here is the output:
>>sudo python /Downloads/python-fs-stack-0.2/setup.py install
running install
running bdist_egg
running egg_info
writing python_fs_stack.egg-info/PKG-INFO
writing top-level names to python_fs_stack.egg-info/top_level.txt
writing dependency_links to python_fs_stack.egg-info/dependency_links.txt
warning: manifest_maker: standard file 'setup.py' not found
error: package directory 'familysearch' does not exist
I would really like to be able to get this package up and running, but I am at a loss. What should I try?

Related

Wheel not built when pip installing from source - causes ModuleNotFoundError

I have written a python package mypackage , hosted on github, that I now want to install as a dependency to another project (specifically branch branch).
I can build it locally using setuptools and a pyproject.toml file by running python3 -m pip install . at the top of mypackage/ and can then successfully import it into python.
I pushed this to github and now try to install it using
python3 -m pip install "git+https://github.com/mygituser/mypackage.git#branch"
This runs without warning, and if I then run python3 -m pip list I can see mypackage listed there. However, if I enter python and run import mypackage I get the error ModuleNotFoundError: No module named 'mypackage'.
Comparing the verbose outputs I can see that for the local install after installing the dependencies I get
running bdist_wheel
running build
running build_py
running egg_info
writing mypackage/mypackage.egg-info/PKG-INFO
writing dependency_links to mypackage/mypackage.egg-info/dependency_links.txt
...
...
etc. which is absent for the github build process (this just ends after dependencies are installed).
Am I missing a setting in pyproject.toml or somewhere to tell it to build a wheel so I can import mypackage it in python?
I have tried appending with #egg=mypackage and adding wheel to the build dependencies, but none of this has worked.
TIA
In addition to the changes you made to your pyprojcet.toml file here: https://github.com/jatkinson1000/archeryutils/commit/f5fb491aa37961a65796ce4be3616d8be23548ed
You also need to include a __init__.py file in your round_data_files folder so it gets included in the package install.
https://github.com/jatkinson1000/archeryutils/pull/9

in virtualenv, pip installing locally from source fails

I am trying to install a library in a virtualenv instance with pip. The library version I want (wxPython 3.0.2)
is not available on PyPi; it is only available for download from SourceForge. Thus, I have the source tarball downloaded on my machine and I am trying to install it in such a way that it will play nicely with virtualenv.
(I am on a Windows computer, running Python 2.7.)
I have tried the following:
doing a direct install: pip install wxPython-src-3.0.2.0.tar.bz2
extracting the files from the tarball to wxPython-src-3.0.2.0, then installing from the extracted directory: pip install wxPython-src-3.0.2.0
extracting the files from the tarball, then navigating into the extracted folder to the nested wxPython directory, which holds the setup.py file, and then installing from there: pip install wxPython
The last attempt seems the most promising, but I get the following traceback:
Processing \wxpython-src-3.0.2.0\wxpython
Complete output from command python setup.py egg_info:
Setuptools must be installed to build an egg
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\__MY_USERNAME__\appdata\local\temp\pip-req-build-q0pxlt\
This is also strange, because it suggests I don't have setuptools even though I can run pip list and see version 40.6.3 installed.
Any help appreciated.
Why not install a precompiled version? There are a lot of .exe files at SF. You probably need wxPython3.0-win64-3.0.2.0-py27.exe.
Also take a look at Christoph Gohlke's collection.
If you still insist on installing from sources please bear in mind that wxPython 3 is so old it predates pip. Forget about pip.
First, you need to install wxWidgets as wxPython is just a Python wrapper for wxWidgets C++ library. Extract wxPython-src-3.0.2.0.tar.bz2 and follow instructions in wxPython-src-3.0.2.0/docs/msw/install.txt.
After compiling and installing wxWidgets compile wxPython. See wxPython-src-3.0.2.0/wxPython/docs/BUILD.txt.
My eventual solution was the easy way out: installing my package (wxPython) locally as #phd suggested, and opting for local package access via either virtualenv --system-site-packages env or deleting the "no-global-site-packages.txt" file in an existing environment folder.
Not what I expected to do, but it works so no complaints.

Does pip install work with single module projects?

I just refactored my Python project to be a single top-level module rather than a package.
However, pip install does not work anymore: I get an error which says:
(forcelib_test) C:\code>pip install git+https://github.com/blokeley/forcelib
Collecting git+https://github.com/blokeley/forcelib
Cloning https://github.com/blokeley/forcelib to c:\users\tomoak~1\appdata\local\temp\pip-t10zegic-build
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info\forcelib.egg-info
writing pip-egg-info\forcelib.egg-info\PKG-INFO
writing dependency_links to pip-egg-info\forcelib.egg-info\dependency_links.txt
writing requirements to pip-egg-info\forcelib.egg-info\requires.txt
writing top-level names to pip-egg-info\forcelib.egg-info\top_level.txt
writing manifest file 'pip-egg-info\forcelib.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
error: package directory 'forcelib' does not exist
I'm not trying to install a package called forcelib, only a module. The setup.py script correctly uses the py_modules argument rather than packages.
Is it possible to install a single module or do I have to revert to using a package?
Note: this question is about a different problem. They want to install an additional text file. I just want to install the single Python module. In fact, that question implies that what I'm trying to do should work without the error I got
I needed to use
py_modules=['forcelib']
Rather than what I had which was
py_modules=['forcelib.py']

Heroku Django app development on Windows

I'm trying to start a Django app on Heroku using Windows and I'm getting stuck on the following error when I try to pip install psycopg2:
Downloading/unpacking psycopg2
Downloading psycopg2-2.4.5.tar.gz (719Kb): 719Kb downloaded
Running setup.py egg_info for package psycopg2
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info\psycopg2.egg-info
writing pip-egg-info\psycopg2.egg-info\PKG-INFO
writing top-level names to pip-egg-info\psycopg2.egg-info\top_level.txt
writing dependency_links to pip-egg-info\psycopg2.egg-info\dependency_links.txt
writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
I've googled the error and it seems you need libpq-dev python-dev as dependencies for postgres under Python. I also turned up a link that says you gt into trouble if you don't have the postgres bin folder in your Path so I installed Postgres manually and tried again. This time I get:
error: Unable to find vcvarsall.bat
I am still a python N00b so I am lost. Could someone point me in a general direction?
You can use Cygwin and install all the dependencies, but I went through that issue last week and then I realized it was far easier to use a Virtual Box with Ubuntu as my Guest OS. I still did the development on Windows but used Ubuntu just to communicate/push to heroku
I found the answer to my problem. I believe the problem is that pip is looking to compile the dependency from source. The solution is to find a link to pre-compiled version of the dependency. You can then pass this link to the easyinstall library installed in your virtualenv. Easyinstall will download and install the pre-compiled version of the dependency.

how to install python libraries in linux?

While I was installing Python libraries on Linux, it threw the below error. How can I fix it?
I ran the below command to install:
python setup.py install
Output:
running install
running build
running build_ext
error: pyconfig.h: No such file or directory
The first thing to try is to install the appropriate module via your package manager. Each distro has many, many, many Python modules already packaged and ready to go.
If you insist on installing a module from source then you'll need the development package for your distro's Python. This is usually called python-devel, python-dev, or something similar. Use the package manager to install it.

Categories

Resources