Hi I am new to Python I want to use an already developed tool/code and I have a problem with the modules used.
I installed Spider with Anaconda version of Python
I am trying to run below code,
https://code.google.com/p/quantandfinancial/source/browse/trunk/example_black_litterman.py
if I understood the code correctly it is referencing the below custom module https://code.google.com/p/quantandfinancial/source/browse/trunk/structures/quote.py?r=25
I stored the two parts of the code in C:\Users\Michal\Documents\Python Scripts and Python is installed in C:\Anaconda3, when I run the code I get an error
File "C:/Users/Michal/Documents/Python Scripts/Black-Litterman.py", line 4, in <module>
from structures.quote import QuoteSeries
ImportError: No module named 'structures'
Please help how can I get this code running?
pip install structures worked for me from normal windows cmd
C:\Users\user>pip install structures
You are using pip version 7.0.3, however version 7.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
> Collecting structures
> Downloading structures-2.0.2.tar.bz2
> Installing collected packages: structures
> Running setup.py install for structures
> Successfully installed structures-2.0.2
You need to do this:
pip install structures
Best idea is probably to first make a conda environment, then you can manage all the packages you need in there.
Related
I can't install any python modules that require python 2.7 or later. I have uninstalled everything that Mac would let me that was related to python 2, and I run everything on python 3. I am completely lost. I am on Mac and whenever I try to install a module(like praw) this pops up.
I used the command
pip install praw
Collecting praw
Using cached https://files.pythonhosted.org/packages/41/89/94c1ec81a05536e2c2a1dc2e8f5402c8ad65963f28948bf41c64621e238b/praw-6.5.0-py2-none-any.whl
ERROR: Package 'praw' requires a different Python: 2.7.16 not in '>=3.5' ```
Welcome to Stack Overflow Malachi! I believe you're looking for the command pip3 (pip3 install praw) to install Python 3 packages through pip. If you open your terminal and type man pip to get the manual page, there is a line that says:
pip is the command to use when installing packages for Python 2, while pip3 is the command to use when installing packages for Python 3.
Looks like the most recent version of praw requires Python 3.5 or greater.
The last version that supported Python 2.7 was praw 5.4.0. If you're still using Python 2.7 and need this package, try running
pip install praw==5.4.0
If you're using Python 3.x, check to see if you're using the right version of pip. If you have both Python 2 and Python 3 installed on your system, you'll likely need to install system wide packages using pip3 instead if pip. In this case, try running
pip3 install praw
Alternatively, if you're targeting a specific Python interpreter (e.g. python3.7, python3.8, etc), and want to be certain that you are using the correct pip executable for your interpreter, you can run pip as a Python package via
python3 -m pip <args>
where python3 can be replaced by any interpreter path.
I have a package that I am trying to install via pip install allen-bradley-toolkit. The package is failing with the following reason.
The problem seems to related to the fact that pip is trying to install 1.0a1.post0 instead of the latest release version 2.0.0. Does anyone have any ideas on what to do about this. Perhaps there is something wrong in my deployment script. You can view the Github Library here to see how I am deploying to PyPi.
There is an issue opened on the GitHub Tracker #2 that you can also reference for more info.
NOTE: The package seems to install fine on my win10 machine. But I am unable to get it to install on a win7 VM.
Ive also tried installing with the following commands:
pip install --no-cache-dir allen-bradley-toolkit
pip install allen-bradley-toolkit==2.0.0 -> this ones throws a 'doesnt exist error`
At https://pypi.python.org/pypi/allen-bradley-toolkit/2.0.0 I see that the wheel is only available for Python 3. You're trying to install it with Python 2.7.
To publish a universal wheel (suitable for both Py2 and Py3) you need to set
[bdist_wheel]
universal = 1
in setup.cfg or run
python setup.py bdist_wheel --universal
The 2nd line of the output has a clue to the problem - "Using cached ..."
You can skip the cache using the --skip-cache --no-cache-dir option to pip install or request an upgrade using the -U option
edit: updated comment with the correct option (although, seems like that wasn't the problem in this specific case).
Okay, so, I'm running Python 3.4.3 with pip 9.0.1, with the setuptools and wheel.
I'm running this inside JetBrains PyCharm Professional 2017.2.3.
The issue I'm having is trying to install the twitter api packages from this tutorial (ya I'm a n00b) http://wiki.openhatch.org/Twitter
I'm struggling with installing the 4 dependencies mentioned in the first part of the tutorial (httplib2, simplejson, oauth2 and python-twitter)
Honestly, I'm just getting back into programming and this is a project I'd like to complete.
So, I need help with:
Installing pip, and how to use it, and where (python shell or command line or)
the dev.twitter.com website (and where to find what I need from there)
Any help is massively appreciated and sorry if I sound really n00by, but do correct me where I'm using incorrect terms etc because that's how I learn I guess :)
If you haven't got pip installed, find your python installation file.Execute it and choose 'Change Python Installation'. Now choose 'pip' to install and 'add python.exe to path'. Wait for it to finish. Now run windows command line and type:
pip install package_name
Sometimes you may experience that a package isn't available on pip or doesn't work.There are 2 common (not always working) ways to install a package without making pip download the file:
1) A package may be available as a .whl file for download.Download it.Now find it and copy its name .Open a command line in dictionary where it is located and type
pip install **now paste the filename and add .whl**'
2)A package is available as a zip file.Packages are often packed into a zip file.Download the file and extract it.Open a command line in it's directory.You may see setup.py file.Run
python setup.py install
When finished installing pip and adding python to path,you can run:
pip install httplib2 simplejson oauth2 python-twitter
Done.
Once you have pip installed, open the command prompt and just type pip install name_of_the_extension.
In this case, pip install httplib2 will install this package.
I believe you have pip installed on your computer, so it shouldn't be a problem to install the 4 packages you need.
Using Python I am trying to install a library called yappi through easy_install. However I am getting this error below on Windows 7 Command Shell:
I explored alternative installations. I tried previously 'pip install yappi' but this didn't work due to a separate error (can't build wheel) which is a separate question.
Try downloading the appropriate wheel from here.
Then use pip install [package].
I have Python 2.4 and 2.7 on my Centos server.
I would like to use PyCURL under Python 2.7.
I ran yum install pycurl and it appeared to install but when I attempt to import PyCURL it works fine for Python 2.4 but not for 2.7.
Can anyone advise how it is possible to install PyCURL (or any other Python extension for that matter as I can see this being an issue in future) to a specific version of python.
Thanks
C
------ SOULTION (thanks gjallar) ----------
Instead of using YUM I downloaded and installed PyCurl by running the setup.py file using the python version I wanted i.e.
sudo python2.7 setup.py install
This still didn't work as I was getting an error saying I had the wrong version of libcurl
To ressolve this I downloaded the latest curl version from http://curl.haxx.se/download.html and installed with the instructions here: http://curl.haxx.se/docs/install.html
Sadly, this still didn't work as when I tried to import pycurl in python I got:
File "<stdin>", line 1, in <module>
ImportError: libcurl.so.4: cannot open shared object file: No such file or directory
This was in turn ressolved by carrying out the command:
export LD_LIBRARY_PATH=/usr/local/lib
As suggested in the post:
Why can't Python find shared objects that are in directories in sys.path?
(Thanks Vinay)
Now it works.
One possible route you can take to install a certain application for a specific python version is to install pip using the specific python version and the use pip to install pyCURL.
In your case this should work by installing pip using python2.7 and then run pip install pycurl:
Install pip via distribute running the setup.py file with your python2.7 interpreter.
This requires pycurl to be available in PyPi - otherwise (if the pycurl download contains a setup.py) simple run the setup.py file using the interpreter you want to install it for.