Attempting to use Project Gutenberg in Python 3 - python-3.x

I was using the Project Gutenberg API (I'm new, forgive me if this isn't actually the right term) with Python 2 just fine. But I needed to start using Python 3 for other reasons.
I'm having a lot of difficulties getting Gutenberg to work with Python 3. I understand (according to this site: https://pypi.org/project/Gutenberg/) that I need to manually install BSD-DB, and I think that's the problem I'm running into.
brew install berkeley-db4
works just fine, but
pip install -r requirements-py3.pip
returns the error:
Could not open requirements file: [Errno 2] No such file or directory: 'requirements-py3.pip'
After research online, I also tried
BERKELEYDB_DIR=$(brew --prefix berkeley-db) YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION=yes pip install bsddb3
which returns the error:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/gb/z8bwwygn0y5gcknl24_7bfz40000gn/T/pip-build-_VUMDe/bsddb3/
I'm sorta overwhelmed by all the things that could be going on and starting to feel my lack of coding knowledge. Any nudge in the right direction would be greatly appreciated.

Related

How to install miniupnpc as a python module on windows

I want to use UPnP in my python scripts, so I tried to install miniupnpc through pip install miniupnpc. But It causes an error a little bit after the installation starts:
ERROR: Command errored out with exit status 1:
cwd: C:\Users\sammy\AppData\Local\Temp\pip-install-jrjs0fss\miniupnpc\
Complete output (4 lines):
running install
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
----------------------------------------
I checked the GitHub but I don't know where to find the tools I need to compile the python module or how to use them.
I believe at the time the library was a little bit bugged, I never worked out the issue in the end, I recommend looking for other tools.
It is also worth mentioning I wasn't a very good programmer back then, I now actually understand the nature of libraries and packages.

"Invalid command bdist_wheel" in Ubuntu 16.04 when building from TF source

I currently am trying to build from Tensorflow 1.5 source because I am trying to implement a model on mobile and had to include some kernels. I have run through .configure in TF and I'm pointing at the 3.5 python location.
I am now trying to build the wheel file and for the life of me cannot get around the invalid command bdist_wheel error. I am currently at the step of building the wheel file using:
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
And I receive the following error:
Thu Feb 22 11:17:38 PST 2018 : === Using tmpdir: /tmp/tmp.XPe7Djtgg2
~/Documents/Git/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles
~/Documents/Git/tensorflow ~/Documents/Git/tensorflow
/tmp/tmp.XPe7Djtgg2 ~/Documents/Git/tensorflow Thu Feb 22 11:17:39 PST
2018 : === Building wheel usage: setup.py [global_opts] cmd1
[cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2
...] or: setup.py --help-commands or: setup.py cmd --help
error: invalid command 'bdist_wheel'
I have also tried making sure wheel is installed but when I type:
sudo pip3 install wheel
I receive the following message.
Requirement already satisfied: wheel in
/usr/local/lib/python3.5/dist-packages
I went into my .bashrc file and have an entry for
export PYTHON_BIN_PATH=/usr/bin/
Now looking in build_pip_package I saw that it is using the line below to trigger the wheel build:
"${PYTHON_BIN_PATH:-python}" setup.py bdist_wheel ${PKG_NAME_FLAG} >/dev/null
At the path /usr/bin/ the symlink for python is for 2.7 which I think is the issue, because when I installed wheel using pip2, the wheel file built but it was for 2.7 and not 3.5 so it stated that it couldnt install the wheel file for the current environment.
I thought that maybe modifying the line above to the below entry would work but I still get the same bdist error. I cannot figure out how to get the wheel to build under 3.5.
"${PYTHON_BIN_PATH:-python3.5}" setup.py bdist_wheel ${PKG_NAME_FLAG} >/dev/null
I also tried setting an alias for python to python3.5 which works fine when I try to call just python at the command prompt but it does not work when it is being called from within the "build_pip_package" wheel building call.
Anyone know how I might be able to resolve this? I assume if I were to install conda I can probably get around this, but I would prefer not to have to deal with that if at all possible.
Thanks!
So I found what my issue was in this specific case. I initially performed the Tensorflow configure and wasn't aware of PYTHON_BIN_PATH at the time. now from reading, it seems that when I ran configure, it should have created this entry (at least from what I understand). This did not happen and it was only when I was dealing with the error stated above that I dug deeper and found that build_pip_package was accessing that variable and that it was not set in my .bashrc. It was at this time that I added the value and was trying to just run the building of the wheel.
After posting here, I then figured I would try rerunning through the full TF building process again and see if I could spot any other errors that I might have missed along the way. It was here that I then got an error stating that /usr/bin/ was a path which just happened to be the same value assigned to PYTHON_BIN_PATH. I modified it to export PYTHON_BIN_PATH=/usr/bin/python3 and then rebuilt tensorflow and once I finished I continued with building the wheel and installing it and all went through correctly.
Hopefully this helps someone at one point.

Error installing winshell (python setup.py egg_info failed with error code 1)

I'm trying to install winshell under Python 3.3.0 / Windows 7.
(I should say that I have only a fuzzy notion of how package installing works, so my apologies if I'm making a basic blunder ... this stuff clearly is not really aimed at mere mortals).
What I did was: I opened a CMD window & navigated to the Python33 directory. I typed
pip install winshell
and got "...downloading winshell 0.6 zip followed by running setup.py egg_info for package winshell...
and then I got
python setup.py egg_info failed with error code 1 (in the log file)
I've tried googling generally and in here - most of the posts are moderately incomprehensible - to me at least. There are tentative suggestions in comments to an answer that suggest I'd need to install either pwin32 or win32con. And that pwin32 can't be installed with pip. But I haven't found a definitive 'how to' for installing winshell.
Before I go down either of those rabbit holes, is it correct that, in order to install & use winshell, do I need those modules? And please point me to the best, simple, instructions for doing that.
...
This is all for the purpose of getting the target path of a shortcut as in:
path = winshell.shortcut(filethatisashortcut).path
so as to kludge os.walk to follow shortcuts (Windows, remember!). If there's a more direct method - please advise.
You need to install the pywin32 module according to the docs:
Prerequisites & Compatibility
The module has been tested on versions of Python from 2.4 to 3.2. It may
also work on older (or newer) versions. You’ll need Python 2.5+ for context
manager support. It’s tested with the most recent pywin32 extensions, but
the functionality it uses from those libraries has been in place for many
versions.
(Also looking at the modules imported in the source files, you clearly need to install Python for Windows extensions (pywin32). Don't have access to a windows machine to test, but why don't you go by the book first.)

Having trouble getting pandas onto Slackware 14

I've been trying to install python-pandas, got an error message:
install requires: 'python-dateutil < 2','numpy'
$ pip install 'python-dateutil < 2' 'numpy'
I'm new to slackware (like the steep learning curve), so I got the binaries from various websites, unpacked the files but I still keep getting this message. I do have a new directory titled 'usr' in my Downloads directory. I'm assuming that's supposed to go in the python directory but I'm not completely sure. Just lookin' for a little advice. Thanks.
My problem was not having pip installed...had to do a few tasks to get that done. But it's all working now.

Install pybrain on python 3.2

I'm trying to install pybrain on python 3.2. It says here: https://github.com/pybrain/pybrain/pull/85 that it should work. However it does not for me.
I tried:
$export PYTHONPATH=$PYTHONPATH:'/home/luis/Documents/pybrain/'https://github.com/pybrain/pybrain/pull/85
which works well for python 2.7.
Did somebody get it to work?
After hours of "what the hell?!"s I installed it.
First the installer suggested is not updated for Python3 so I installed Distribute. With that installed I was able to use python setup.py install in the directory where I unrared pybrain. It gave a ton of errors. So I found this article (god bless google translate) and used 2to3 on pybrain directory. After I tried to install it again it gave an error on from string import split so I edited the file and removed that line (it is not needed really) and tried yet another time. This time no errors occurred and I was able to import pybrain without any problems. The same problem with the from string import split occurs in utilities.py again, so edit that line too.
I used 2to3 to turn examples to python3 too. benchmarkplots.py seems to work.
Update:
pybrain now supports python3
Here's how to install if you run into trouble
pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip
Or just grab latest github pybrain release.

Resources