conda-build using an old (stale) setup.py - python

I am trying to generate a conda package (using conda-build) from some python source files and other DLL files. I first use a setup.py file to generate the python source code tar.gz file in the dist folder. All this works fine.
Then I am trying to create a conda tarball (tar.bz2) file by using conda-build. However it bombs out saying it cannot fine py2exe in setup.py. I had imported py2exe in the setup.py as an experiment at one point but have removed it since. The current setup.py does not have this import. So, I'm not sure why conda-build is still complaining about this. I even tried deleting all the files and directories that I think might be causing the problem and starting from scratch and it still complains. So, it's using a cached file from somewhere but I have no idea where. My bld.bat that conda-build uses is simply this:
%PYTHON% setup.py install
if errorlevel 1 exit 1
My recipe file is:
package:
name: projectname
version: 1.0.0
source:
url: ../dist/projectname-1.0.0.tar.gz
build:
number: 1
include_recipe: True
requirements:
build:
- python
run:
- python
Here is the relevant output of conda-build:
(%BUILD_PREFIX%) %SRC_DIR%>%BUILD_PREFIX%\python.exe setup.py install
Traceback (most recent call last): File "setup.py", line 2, in
import py2exe ModuleNotFoundError: No module named 'py2exe'
(%BUILD_PREFIX%) %SRC_DIR%>if errorlevel 1 exit 1 Traceback (most
recent call last): File
"d:\Continuum\anaconda3.5\Scripts\conda-build-script.py", line 10, in
sys.exit(main())

I was able to resolve the issue. For anyone else who may experience this issue, I did a global search for setup.py and found the offending file in the conda-bld folder that conda-build generates. I deleted the conda-bld and it resolved the issue.

Related

Error when running install and import from Github

I am using python; colab.
I tried to install package from" github.com/jleinonen/keras-fid" to import fid. And first time I used:
!pip install git+git://github.com/jleinonen/keras-fid.git
but I got error;
Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
So I used: !git clone
I install package from Github by using
!git clone https://github.com/jleinonen/keras-fid.git
than try to import module
However, I'm not sure but I think because package name contains "-", I got
SyntaxError: invalid syntax
How can I import the module from this package
The - is a red herring. The problem is that the Github repo cannot be pip installed because it does not contain a setup.py.
When you git cloned the code, you simply copied it to your environment. It's still not trivially installable ... though what you can do now is either add the cloned directory to your PYTHONPATH, or copy the file fid.py from inside it to somewhere which is already on your PYTHONPATH.
Quick demo:
bash$ python -c "import fid"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'fid'
bash$ git clone https://github.com/jleinonen/keras-fid.git
Cloning into 'keras-fid'...
remote: Enumerating objects: 12, done.
remote: Total 12 (delta 0), reused 0 (delta 0), pack-reused 12
Unpacking objects: 100% (12/12), done.
Now, we have a local clone, but as you can see, it is not yet installed:
bash$ python -c "import fid"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'fid'
You can add the directory name (which does contain a hyphen, but that's unproblematic here) to your PYTHONPATH, and then it works ... except the code contains a syntax error.
bash$ PYTHONPATH=${PYTHONPATH+$PYTHONPATH:}`pwd`/keras-fid python -c "import fid"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/keras-fid/fid.py", line 134
def __init__(self, generator, image_range=,
^
I have no idea what the code is supposed to do, and I know nothing about Keras or Google Colab; but changing it to image_range, without an equals sign before the comma at least lets me bypass this error.
how to add the path to PYTHONPATH in google colab seems to have tips for how to do something similar inside Google Colab.

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'

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.

Emacs deferred errors

I have installed the Emacs package jedi-emacs using M-x package install
and the following Python packages:
Jedi
EPC
argparse
using:
pip install --install-option="--prefix=~/.my_python_packages/" jedi
pip install --install-option="--prefix=/.my_python_packages/" epc
pip install --install-option="--prefix=/.my_python_packages/" argparse
since I do not have root priviledges.
When I open a Python file, I get the following error in the minibuffer, no matter where I place the cursor:
deferred error : (error Server may raise an error : Traceback (most recent call last):
File "/home/avazquez/.emacs.d/elpa/jedi-20130119.830/jediepcserver.py", line 261, in <module>
)
What could be causing it?
This is with Emacs 24.2.1
I found the solution to my problem. I did not have PYTHONPATH set up correctly (it should include the corresponding paths for /path/to/custom-packages).
For more info on this issue see the corresponding ticket in the package repository for emacs-jedi.

Categories