Discussion:
[Jython-users] ImportError: No module named nflgame
Thufir Hawat
2017-01-16 18:50:19 UTC
Permalink
Fairly basic usage, but how do I use PIP from Jython? The package is
installed:



***@doge:~/jython$
***@doge:~/jython$ jython nfl.py
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
Traceback (most recent call last):
File "nfl.py", line 2, in <module>
import nflgame
ImportError: No module named nflgame
***@doge:~/jython$
***@doge:~/jython$ pip show nflgame
Name: nflgame
Version: 1.2.20
Summary: An API to retrieve and read NFL Game Center JSON data. It can
work with real-time data, which can be used for fantasy football.
Home-page: https://github.com/BurntSushi/nflgame
Author: Andrew Gallant
Author-email: ***@burntsushi.net
License: UNLICENSE
Location: /home/thufir/.local/lib/python2.7/site-packages
Requires: beautifulsoup4, pytz, httplib2
***@doge:~/jython$
***@doge:~/jython$ cat nfl.py
#!python
import nflgame

games = nflgame.games(2013, week=1)
players = nflgame.combine_game_stats(games)
for p in players.rushing().sort('rushing_yds').limit(5):
msg = '%s %d carries for %d yards and %d TDs'
print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)



***@doge:~/jython$





thanks,

Thufir
Debabrata Pani
2017-01-17 02:16:26 UTC
Permalink
Hi Thufir,

Can you share the output of "which pip" command ?
Probably nflgame is installed with "python" and not with "jython"

Regards,
Debabrata Pani
Post by Thufir Hawat
Fairly basic usage, but how do I use PIP from Jython? The package is
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
File "nfl.py", line 2, in <module>
import nflgame
ImportError: No module named nflgame
Name: nflgame
Version: 1.2.20
Summary: An API to retrieve and read NFL Game Center JSON data. It can
work with real-time data, which can be used for fantasy football.
Home-page: https://github.com/BurntSushi/nflgame
Author: Andrew Gallant
License: UNLICENSE
Location: /home/thufir/.local/lib/python2.7/site-packages
Requires: beautifulsoup4, pytz, httplib2
#!python
import nflgame
games = nflgame.games(2013, week=1)
players = nflgame.combine_game_stats(games)
msg = '%s %d carries for %d yards and %d TDs'
print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)
thanks,
Thufir
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
https://lists.sourceforge.net/lists/listinfo/jython-users
Thufir
2017-01-17 12:39:22 UTC
Permalink
Exactly the problem. How do I install PIP packages with Jython?




***@doge:~/NetBeansProjects/nfl$
***@doge:~/NetBeansProjects/nfl$ which pip
/home/thufir/.local/bin//pip
***@doge:~/NetBeansProjects/nfl$
***@doge:~/NetBeansProjects/nfl$ pip -V
pip 9.0.1 from /home/thufir/.local/lib/python2.7/site-packages (python 2.7)
***@doge:~/NetBeansProjects/nfl$
***@doge:~/NetBeansProjects/nfl$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
***@doge:~/NetBeansProjects/nfl$
***@doge:~/NetBeansProjects/nfl$ jython -V
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
Jython 2.5.3
***@doge:~/NetBeansProjects/nfl$




thanks,

Thufir
Post by Debabrata Pani
Hi Thufir,
Can you share the output of "which pip" command ?
Probably nflgame is installed with "python" and not with "jython"
Regards,
Debabrata Pani
Post by Thufir Hawat
Fairly basic usage, but how do I use PIP from Jython? The package is
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
File "nfl.py", line 2, in <module>
import nflgame
ImportError: No module named nflgame
Name: nflgame
Version: 1.2.20
Summary: An API to retrieve and read NFL Game Center JSON data. It can
work with real-time data, which can be used for fantasy football.
Home-page: https://github.com/BurntSushi/nflgame
Author: Andrew Gallant
License: UNLICENSE
Location: /home/thufir/.local/lib/python2.7/site-packages
Requires: beautifulsoup4, pytz, httplib2
#!python
import nflgame
games = nflgame.games(2013, week=1)
players = nflgame.combine_game_stats(games)
msg = '%s %d carries for %d yards and %d TDs'
print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)
thanks,
Thufir
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
https://lists.sourceforge.net/lists/listinfo/jython-users
Jeff Allen
2017-01-19 18:24:28 UTC
Permalink
Hi Thufir,

There is quite good support for pip beginning Jython 2.7 on Linux, for
which I believe we have to thank Jim Baker. You want a 2.7 version of
Python anyway, because nflgame (nfldb) offers to work only with 2.6 or
2.7. For a start, it uses str.format, and I think I'm correct in saying
that it wasn't available in 2.5.

Thanks for trying this with Jython: I tried this for myself and got a
little further than you. I have Jython 2.7.0 installed at ~/Jython2.7.0
(so I don't need root), but I thought I'd see in virtualenv worked for
me, since I've little lasting interest in football.

I made this work on Linux Mint:
1. Put the Jython bin directory first on your path ("export
PATH=~/Jython2.7.0/bin"), and check using which pip that you get
Jython's version of pip.
2. "pip install virtualenv" will give you virtualenv in your (home)
jython installation.
3. Now cd to where you want to work and "jython -m virtualenv jve"
will install you an environment called jve.
4. ". jve/bin/activate" will activeate it (note it is "bin" not
"Scripts"). Now "which pip" should show an executable in the virtual
environment.
5 "pip install nflgame" starts well, but here I ran out of heap
space. :( You may have better luck: my Linux laptop is quite small.

I was able to install gallows (a small console game) the same way,
without the heap problem, although for some reason gallows.py landed in
the bin directory, not in site-packages. After moving the file, the game
worked.

Sorry this is not a canned solution, but maybe this gets you onto more
interesting problems.

Jeff Allen
Post by Thufir
Exactly the problem. How do I install PIP packages with Jython?
/home/thufir/.local/bin//pip
pip 9.0.1 from /home/thufir/.local/lib/python2.7/site-packages (python 2.7)
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
Jython 2.5.3
thanks,
Thufir
Post by Debabrata Pani
Hi Thufir,
Can you share the output of "which pip" command ?
Probably nflgame is installed with "python" and not with "jython"
Regards,
Debabrata Pani
Post by Thufir Hawat
Fairly basic usage, but how do I use PIP from Jython? The package is
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
File "nfl.py", line 2, in <module>
import nflgame
ImportError: No module named nflgame
Name: nflgame
Version: 1.2.20
Summary: An API to retrieve and read NFL Game Center JSON data. It can
work with real-time data, which can be used for fantasy football.
Home-page: https://github.com/BurntSushi/nflgame
Author: Andrew Gallant
License: UNLICENSE
Location: /home/thufir/.local/lib/python2.7/site-packages
Requires: beautifulsoup4, pytz, httplib2
#!python
import nflgame
games = nflgame.games(2013, week=1)
players = nflgame.combine_game_stats(games)
msg = '%s %d carries for %d yards and %d TDs'
print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)
thanks,
Thufir
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
https://lists.sourceforge.net/lists/listinfo/jython-users
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
https://lists.sourceforge.net/lists/listinfo/jython-users
Loading...