How do I install the Pygraphics module - python

I am trying to download the Pygraphics module using Python 2.7.6 and have been heretofore unsuccessful. Below I detail the steps I have taken so far. Any help with this would be most appreciated.
First, I tried the typical install using pip
sudo pip install Pygraphics
When I try to import the module, I receive an error saying ImportError: No module named Pygraphics.
To test whether the module was installed I ran the following code: print sorted(["%s==%s" % (i.key, i.version) for i in pip.get_installed_distributions()]) which showed me all of my installed distributions.
This code returned the following list of all the distributions and clearly showed that Pygraphics is installed:
['altgraph==0.10.2', 'bdist-mpkg==0.5.0', 'bonjour-py==0.3', 'brewer2mpl==1.4', 'certifi==14.05.14', 'datetime==4.0.1', 'flask==0.10.1', 'ggplot==0.6.5', 'ipython==2.0.0-dev', 'itsdangerous==0.24', 'jdcal==1.0', 'jinja2==2.7.3', 'macholib==1.5.1', 'markupsafe==0.23', 'matplotlib==1.4.x', 'mock==1.0.1', 'modulegraph==0.10.4', 'nose==1.3.4', 'numpy==1.9.0.dev-297f54b', 'openpyxl==2.1.2', 'pandas==0.14.1', 'pandasql==0.6.1', 'patsy==0.3.0', 'pika==0.9.14', 'py2app==0.7.3', 'pygments==1.6', 'pygraphics==2.1']
After this, I tried using the GUI installer located on the following Pygrahpics install website. While going through the installer, I received an error message saying "PyGraphics requires System Python 2.7 to install" despite the fact that I have downloaded Python 2.7.6.
At this point I don't know what to do and was hoping someone who may have had a similar issue might be able to help me out.
Thank you for your time.

It looks like you've successfully install PyGraphics. Now import picture :)

Related

Why does Importing Pennylane give out cannot import name "shape"

I am trying to import Pennylane in jupyter notebook. I installed it using Ubuntu.
import pennylane as cents
However, it is spewing out this:
ImportError: cannot import name 'shape'
I found two reasons online. One is that python needs to be at version less than 3.7[https://github.com/PennyLaneAI/pennylane/issues/1922]. To solve this I used pip install -U jupyter. Another reason is that Pennylane might be at a version earlier enough that it had a bug[https://discuss.pennylane.ai/t/importerror-cannot-import-name-shape/1383]. I installed Pennylane to the latest version I could find, 0.25. I did pip install pennylane==0.25 But it still does not work
Could someone please explain this to me?

Trying to import GitHub module

I'm trying to import https://github.com/chrisconlan/algorithmic-trading-with-python in my code. I've never imported anything from GitHub before and have looked at various other questions that have been asked on Stack Overflow regarding this problem but it just doesn't work. When I try to run the 'portfolio.py' code for example I keep getting a ModuleNotFound error for 'pypm'. What exactly is the correct way to import such a module or the whole GitHub directory?
I'm working with Visual Studio Code on Windows.
You will need to pip install the module. In your case the command you would need to run is python -m pip install -U git+https://github.com/chrisconlan/algorithmic-trading-with-python. Once you have done that you need to find the name of the module. You can do this with pip list. Find the name of the module you just installed.
Then you just stick import <module name> at the top of your code with the rest of your imports.
What i used to do in this is to clone the repository on the folder where are installed the python's packages. This is useful when you do not want to use the pip cmd tool, keeping the pip's cache memory under control.

Downloaded package ImportError

I have recently installed python 2.17.14 to use a package which I installed in the command prompt with:
python -m pip install packageName
However, whenever I try to use it with a script provided by the package authors, I get Import Errors:
ImportError: cannot import X from YX
ImportError: attempted relative import with no known parent package.
I don't know what I'm doing wrong, as I am really new to Python. Does anyone have any ideas?
The package is called neurodesign and I downloaded the try out script from the official website "neuropowertools.org"
Best,
Max
In case anyone (who is also new to python^^) fails ridiculously at this task as well: I had to manually install all the modules used within this package for it to work as they weren't installed automatically.

Getting "no module named builtin" ImportError

I'm getting:
"ImportError: No module named builtins"
that has only started happening after I installed a later version of PsychoPy (an application that uses Python that is used for writing psychology experiments). I was not getting this problem with an older version
I tried doing "sudo pip install future" like someone else recommended for fixing a similar problem. However, when I do this I get an "invalid syntax" error, and don't know of any other way around the problem. I would greatly appreciate any help on this.
Edit
Could it be you enter the command into a Python prompt? You are supposed to enter that command on the command line of your operating system shell. Which means not inside Python.
Original Answer
Like Deesha already mentioned in their comment, you must install the future package into the Python environment you wish to run PsychoPy in, e.g. via pip:
pip install future
or via conda:
conda install future
This is because newer versions of PsychoPy support both Python 2.7 and 3. The future package is used to ensure the code runs on both platforms.

ModuleNotFoundError: No module named 'bs4' but I have bs4 installed I believe

So I am not able to import BeautifulSoup after I have installed bs4.
I have tried installing bs4 using pip, pip3, and pip3.6. All successfully install bs4, but I still get the error saying there is no module named bs4 when I try and import it.
I have also tried doing it by using "pip install beautifulsoup4" with no luck.
I am using python 3.6.5 on Windows 10.
This is the output of my pip commands
Let me know things I can try differently to get this working.
Thanks for any help.
Had two installs of Python. Man I feel like an idiot haha. The second install was hidden in a visual studio folder.
I had a similar issue - but switched my interpreter (in pycharm) from the 'local' to the global python scripts.
Successful running of script on local html files and on requests.
Thank you to this thread and one other for helping me fix the issue.

Categories