Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pex.resolver.Untranslateable when using setup from setuptools #41

Closed
bqm opened this issue Feb 2, 2015 · 3 comments
Closed

pex.resolver.Untranslateable when using setup from setuptools #41

bqm opened this issue Feb 2, 2015 · 3 comments

Comments

@bqm
Copy link

bqm commented Feb 2, 2015

Hello,

I am trying to build a pex file with several requirements and my own package that has a setup.py.

From reading pex --help, I understand that I need to use the -s to provide the directory that contains my setup.py file.

I get this error:

pex -s . -e greatpackage.script -o output.pex
**** Failed to install greatpackage-0.1. stdout:

**** Failed to install greatpackage-0.1. stderr:
Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
IOError: [Errno 2] No such file or directory: 'setup.py'

Traceback (most recent call last):
  File "/Users/bqm/garbage/reproducible/env/bin/pex", line 9, in <module>
    load_entry_point('pex==0.8.4', 'console_scripts', 'pex')()
  File "/Users/bqm/garbage/reproducible/env/lib/python2.7/site-packages/pex/bin/pex.py", line 325, in main
    pex_builder = build_pex(args, options)
  File "/Users/bqm/garbage/reproducible/env/lib/python2.7/site-packages/pex/bin/pex.py", line 303, in build_pex
    cache_ttl=options.cache_ttl)
  File "/Users/bqm/garbage/reproducible/env/lib/python2.7/site-packages/pex/resolver.py", line 229, in resolve
    new_requirements.update(requires(highest_package, requirement))
  File "/Users/bqm/garbage/reproducible/env/lib/python2.7/site-packages/pex/resolver.py", line 201, in requires
    raise Untranslateable('Package %s is not translateable.' % package)
pex.resolver.Untranslateable: Package SourcePackage('file:///Users/bqm/.pex/build/greatpackage-0.1.tar.gz') is not translateable.

Here is a way to reproduce my error:

mkdir reproducible
cd reproducible
virtualenv env
. env/bin/activate
pip install wheel
pip install pex
mkdir greatpackage
echo '
from setuptools import setup, find_packages

setup(
    name="greatpackage",
    version="0.1",
    author="bqm",
    packages=find_packages(),
    scripts=["greatpackage/script.py"]
)' > setup.py

touch greatpackage/__init__.py

echo '
if __name__ =="__main__":
  print "Hello world!"
' > greatpackage/script.py

pex -s . -e greatpackage.script -o output.pex

Am I missing something? What am I doing wrong?
Thanks

@bqm
Copy link
Author

bqm commented Feb 2, 2015

I forgot to mention:
I am using macosx 10.10 and python 2.7.6

@jsirois
Copy link
Member

jsirois commented Feb 2, 2015

I have not dug into pip code to see how it special cases for this, but pex -s does not auto-include setup.py so you'll need a MANIFEST. Additionally, instead of installing wheel, you just need to --no-wheel for now.

A working example built off yours:

mkdir reproducible
cd reproducible
virtualenv env
. env/bin/activate
pip install pex
mkdir greatpackage

cat << EOF > setup.py
from setuptools import setup, find_packages

setup(
    name="greatpackage",
    version="0.1",
    author="bqm",
    packages=find_packages(),
    scripts=["greatpackage/script.py"]
)

EOF

cat << EOF > MANIFEST.in
include *.py

EOF

touch greatpackage/__init__.py

cat << EOF > greatpackage/script.py
if __name__ == "__main__":
  print("Hello world!")

EOF

pex --no-wheel -s . -e greatpackage.script -o output.pex
./output.pex

See this discussion for reference: https://groups.google.com/forum/#!searchin/pants-devel/Trying$20to$20make$20a$20single$20executable$20file$20with$20PEX/pants-devel/WDMzxuW0ybs/hmblP6i_vbcJ

@bqm
Copy link
Author

bqm commented Feb 4, 2015

That was very helpful!
Thank you

@bqm bqm closed this as completed Feb 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants