Error while trying to port a repo from github - python

There is a github code I am trying to use that is located here.
I am trying to run params.py which is a code that will take a binary file and converts it so that I can plot it (or so I think).
I tried to run:
pip install git+https://github.com/PX4/pyulog.git
However, that gave me an error:
C:\Users\Mike\Documents>pip install git+https://github.com/PX4/pyulog.git
Collecting git+https://github.com/PX4/pyulog.git
Cloning https://github.com/PX4/pyulog.git to c:\users\mike\appdata\local\temp\pip-t_vvh_b0-build
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Anaconda3\lib\tokenize.py", line 454, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Mike\\AppData\\Local\\Temp\\pip-t_vvh_b0-build\\setup.py'

Pip install tries to install the module from :
PyPI (and other indexes) using requirement specifiers.
VCS project urls.
Local project directories.
Local or remote source archives.
When looking at the items to be installed, pip checks what type of item each is, in the following order:
Project or archive URL.
local directory (which must contain a setup.py, or pip will report an error).
Local file (a sdist or wheel format archive, following the naming conventions for those formats).
A requirement, as specified in PEP 440.
In your case, git repo doesn't meet the requirement. It doesn't have setup.py that's why you get the error.
Instead try cloning the repo on your local machine.

Related

python setup.py sdist error Versioning for this project requires either an sdist tarball, or access to an upstream git repository

tosca-parser downloaded from github, when using python setup.py develop, it complains: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. So I use python setup.py sdist instead, the error is the same:
ERROR:root:Error parsing
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pbr/core.py", line 96, in pbr
attrs = util.cfg_to_args(path, dist.script_args)
File "/usr/lib/python2.7/site-packages/pbr/util.py", line 270, in cfg_to_args
pbr.hooks.setup_hook(config)
File "/usr/lib/python2.7/site-packages/pbr/hooks/__init__.py", line 25, in setup_hook
metadata_config.run()
File "/usr/lib/python2.7/site-packages/pbr/hooks/base.py", line 27, in run
self.hook()
File "/usr/lib/python2.7/site-packages/pbr/hooks/metadata.py", line 26, in hook
self.config['name'], self.config.get('version', None))
File "/usr/lib/python2.7/site-packages/pbr/packaging.py", line 874, in get_version
name=package_name))
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name tosca-parser was given, but was not able to be found.
error in setup command: Error parsing /home/tiina/tosca/tosca-parser-master/setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name tosca-parser was given, but was not able to be found.
I run the same command after git init, then the error is gone. What I don't understand is from where it requires an upstream git repository?
To disable all version calculation logic of pbr set PBR_VERSION
$ export PBR_VERSION=1.2.3
$ python setup.py sdist
or on one line
$ PBR_VERSION=1.2.3 python setup.py sdist
According to pbr docs
pbr, when run in a git repo, derives the version of a package from the git tags. When run in a tarball with a proper egg-info dir, it will happily pull the version from that. So for the most part, the package maintainers shouldn’t need to care. However, if you are doing something like keeping a git repo with the sources and the packaging intermixed and it’s causing pbr to get confused about whether its in its own git repo or not, you can set PBR_VERSION

how to customise files being copied into tmp directory when running a local pip install?

I'm trying to pip install the python binding of MXNet library from source code:
https://mxnet.incubator.apache.org/install/ubuntu_setup.html#install-mxnet-for-python
After the main binary is built successfully using g++, there is no problem in installing its python binding in dev/editable mode:
pip install -e .
however when I try to deploy the full package (instead of just creating a symbolic link)
pip install .
I encounter the following error:
Processing ~/git-fork/mxnet/python
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-k3hfc693/setup.py", line 47, in <module>
LIB_PATH = libinfo['find_lib_path']()
File "/tmp/pip-req-build-k3hfc693/mxnet/libinfo.py", line 74, in find_lib_path
'List of candidates:\n' + str('\n'.join(dll_path)))
RuntimeError: Cannot find the MXNet library.
List of candidates:
/tmp/pip-req-build-k3hfc693/mxnet/libmxnet.so
/tmp/pip-req-build-k3hfc693/mxnet/../../lib/libmxnet.so
/tmp/pip-req-build-k3hfc693/mxnet/../../build/libmxnet.so
../../../libmxnet.so
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-k3hfc693/
It appears that pip didn't copy ../../lib/libmxnet.so into tmp since it is outside the python package directory. What should I do to instruct pip to copy that file (and if possible, everything under parent directory) when installing?
Where is your libmxnet.so located? It should be in the main-directory, so in your case: /git-fork/mxnet. Then the setup.py script should work out of the box. You could also manually set the path in setup.py, by adjusting the following line LIB_PATH = libinfo'find_lib_path'

pip install setup.py missing when attemping install of pyodbc wheel file

i'm trying to update the pyodbc package from 4.0.16 to 4.0.22.
i dont have internet access on the machine i'm working on so downloaded the file and copied to across the network.
running
pip install S:\Temp\PMCD\pyodbc-4.0.22-py27hc56fc5f_0(1).tar.bz2
results in the following error:
Processing s:\temp\pmcd\pyodbc-4.0.22-py27hc56fc5f_0(1).tar.bz2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'c:\\users\\adm_pa~2\\appdata\\local\\temp\\2\\pip-yf25bd-build\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\adm_pa~2\appdata\local\temp\2\pip-yf25bd-build\
setuptools has already been updated to latest(38.5.1) and pip as well (9.0.1)
i used pip to update setuptools and pip itself (via downloaded whl files), so i dont think pip is an issue.
i already managed to sucessfully upgrade pyodbc on my local machine from 16 to 22, so the whl file i have not sure whats going on.
Any ideas whats going on?
Could i manually unzip the package and place it directly in the site-packages? that didnt seem to do anything.
If your target machine does not have a direct Internet connection you can still install pyodbc by
using another machine to download the appropriate wheel (.whl) file from PyPI,
copying that file to your target machine (via LAN, SneakerNet, ...), and
using pip install <wheel_file_location>
For example,
pip install C:\__tmp\pyodbc-4.0.22-cp27-cp27m-win_amd64.whl
The naming convention for wheel files is described in PEP 491.
The 64-bit wheel files for Windows are tagged as "win_amd64" because that's what the Windows version of distutils reports as the platform:
>>> from distutils import util
>>> distutils.util.get_platform()
'win-amd64'

Error when downloading package using git+ssh

I am working on creating a private package repository for my company and am trying to download the package from Github. I believe the package should compile, as I have uploaded this as a test function to PyPI.
The error I get is: FileNotFoundError: [Errno 2] No such file or directory: setup.py I am cloning the repo back into the exact same environment in which the function was created - what could be wrong?
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\tokenize.py", line 454, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory:
'C:\\Users\\ALLENB~1\\AppData\\Local\\Temp\\pip-07k46aoa-build\\setup.py'
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\ALLENB~1\AppData\Local\Temp\pip-07k46aoa-build\setup.py
setup.py is not part of the Python/Anaconda 3 installation location!
It's included with the package that you wish to install. Change directories to the location of the source that you download it with pip install (or with: py -m pip install) and then run the setup.py file.
EDIT:
Add #subdirectory=folder_name to your code.

Twilio for Python installation errror (Win10)

I successfully added python to my PATH. I found these instructions on https://www.twilio.com/docs/python/install#installation.
I get the following error when I try to run the following command on my Command Prompt :
python setup.py install
Error :
C:\Python27>python setup.py install
Traceback (most recent call last):
File "setup.py", line 6, in <module>
with open('twilio/version.py') as f:
IOError: [Errno 2] No such file or directory: 'twilio/version.py'
I also took out the setup.py file from the twilio folder and placed it into C:\Python27 directory.
Why is this error occuring ?
It's better to install it via pip:
pip install twilio
If you must install it from source, first unpack the source code from the zip archive. Then locate the setup.py file. You need to run it in the same directory. So for example, if you unpacked twilio to D:\twilio and your setup file path is D:\twilio\setup.py, you first need to change directory to there.
cd D:\twilio\setup.py
python setup.py install
Looks like you tried to copy the setup.py file to your Python installation folder and tried to run it from there. That will not work since the setup file depends on other files in that unpacked source directory.

Categories