jgilchrist / pybib

Get BibTeX citations from your terminal
BSD 3-Clause "New" or "Revised" License
26 stars 2 forks source link

Won't pip install #1

Closed lmmx closed 9 years ago

lmmx commented 9 years ago

Hey man! :smiley: Cool package, but sorry to say when I tried to install it I got

error: file '/tmp/pip_build_louis/pybib/bin/pybib' does not exist`.

After I renamed bin/bib to bin/pybib and reverted the last commit to give it the file it seemed to want it didn't error out, but doesn't seem to be set up properly.

I can import pybib inside Python just fine, but I don't get a shell command bib (or pybib FWIW).

~ $ pip3 install --user pybib
Downloading/unpacking pybib
  Downloading pybib-1.2.tar.gz
  Running setup.py (path:/tmp/pip_build_louis/pybib/setup.py) egg_info for package pybib

Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python3/dist-packages (from pybib)
Installing collected packages: pybib
  Running setup.py install for pybib
    error: file '/tmp/pip_build_louis/pybib/bin/pybib' does not exist
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_louis/pybib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e4yjck6f-record/install-record.txt --single-version-externally-managed --compile --user:
    running install

running build

running build_py

creating build

creating build/lib

creating build/lib/pybib

copying pybib/drivers.py -> build/lib/pybib

copying pybib/pybib.py -> build/lib/pybib

copying pybib/__init__.py -> build/lib/pybib

running build_scripts

creating build/scripts-3.4

copying and adjusting bin/bib -> build/scripts-3.4

error: file '/tmp/pip_build_louis/pybib/bin/pybib' does not exist

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_louis/pybib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e4yjck6f-record/install-record.txt --single-version-externally-managed --compile --user failed with error code 1 in /tmp/pip_build_louis/pybib
Storing debug log for failure in /home/louis/.pip/pip.log

(After forking and renaming things)

 ~ $ pip3 install --user git+https://github.com/lmmx/pybib.git
Downloading/unpacking git+https://github.com/lmmx/pybib.git
  Cloning https://github.com/lmmx/pybib.git to /tmp/pip-4qk7xucp-build
  Running setup.py (path:/tmp/pip-4qk7xucp-build/setup.py) egg_info for package from git+https://github.com/lmmx/pybib.git

Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python3/dist-packages (from pybib==1.2)
Installing collected packages: pybib
  Running setup.py install for pybib
    changing mode of build/scripts-3.4/pybib from 644 to 755

    changing mode of /home/louis/.local/bin/pybib to 755
Successfully installed pybib
Cleaning up...
~ $ bib myfile.ext
No command 'bib' found, did you mean:
. . . . . .
bib: command not found
jgilchrist commented 9 years ago

Hey Louis! Thanks for the issue, it's actually something I fixed a little while ago but I forgot to upload another version to PyPi with the fix.

The issue stems from the fact that the setup.py script in the build currently on PyPi expects two scrips, bib and pybib to exist in the bin/ folder, which is how it worked before I consolidated the functionality into bib.

I've submitted a new version to PyPi (1.2.1) - attempting to install this version works on my machine with pip3 install --user pybib (the command it installs is bib).

Could you let me know if this worked for you?

lmmx commented 9 years ago

Hmmm, installed OK and thought it was sorted but there's still no bib command...

Don't know if this is proper usage but I tried making a dummy file with 1 line, 10.3389/fcell.2014.00040, mydoi.txt in ~/Desktop, ran find / -type d -name pybib and tried bib in there to the same effect. Straight up ~/.local/lib/python3.4/site-packages/pybib $ python3 pybib.py ~/Desktop/mydoi.txt also came back empty.

I get the same in a Biolinux virtual machine (Ubuntu 12.04 LTS)

jgilchrist commented 9 years ago

bib on my system is located in ~/.local/bin, does that exist for you?

lmmx commented 9 years ago

Ahh there it is, yeah - not automatically exported to shell after installation though. Oddly exporting to PATH in .bashrc doesn't create the shell command either, have you got an alias set up?

jgilchrist commented 9 years ago

Could you please try the following:

Add the path to your .bashrc again:

# in .bashrc
export PATH="${PATH}:~/.local/bin"

Source it (or restart the terminal):

source ~/.bashrc

Then try bib again, and if it doesn't work then paste the output of echo $PATH?

lmmx commented 9 years ago

Ohhh.. :sweat_smile: yeah that works.. I must have mucked up the path line, I do apologise!

~ $ bib
usage: bib [-h] [-o OUT] [-v] [-f [FILE]] [DOI]
bib: error: one of the arguments DOI -f/--file is required
jgilchrist commented 9 years ago

Brilliant :smile:

jgilchrist commented 9 years ago

I'll put something in the README to make sure people have the local pip binary path in their path.

lmmx commented 9 years ago

Sounds like a plan. Also I was going to mention that you might want to peruse Carl Boettiger's knitcitations R package, I've been using it with Rmarkdown docs and it's pretty nice. It uses the CrossRef API (starting here), I guess it'd be easier to port something else rather than write from scratch

jgilchrist commented 9 years ago

Looks nice! I made this just for personal usage when writing things for Uni really. Primarily I use it to grab individual citations for new papers and add them to an existing .bib file, like so:

bib 10.3389/fcell.2014.00040 >> existing_citations.bib

# (piped through bibtool - another program which formats the entry and auto-generates a citation key:
bib 10.3389/fcell.2014.00040 | bibtool >> existing_citations.bib

And that's pretty much the extend of my usage.

lmmx commented 9 years ago

I like it, Carl's package lets you get a bit more elaborate with in-text citations that address the bibliography through those unique referents like @Weiser_1993, which are handled such that you get the same effect as Word's cross-referencing of numbered citations in the (knitr/pandoc-generated) pdf.

I dropped you a tweet anyway, sure a lot of folks would find this useful :-)

jgilchrist commented 9 years ago

That sounds really handy, I can see how it would be useful. I personally prefer doing it this way just because it ensures that I don't need any specific tool to build my document if I lose the code to this way down the line, but it does mean you need the extra step!

Thanks for the tweet :smile:

lmmx commented 9 years ago

Another reason I'm not wholly behind the approach is that it contributes to a pretty gruesome scaling of time-to-compile-to-pdf with number of citations, and don't mention it :hatched_chick: