I want to setup an oauth library for Python on my windows desktop. I am newbie and this is my second day on Python and I having a tonne of trouble.
I downloaded the python-oauth2 (hudson-python-oauth2-167.zip) from github. I have extracted this to my python32 folder. When I run the setup command "python setup.py", I first got a syntax error on the print statement. I assumed it is because I am running on windows and so I changed it and then ran the setup.
I then got the following error:
Traceback (most recent call last):
File "C:\Python32\simplegeo-python-oauth2-1920657\setup.py", line 2, in
from setuptools import setup, find_packages
ImportError: No module named setuptools
Can someone guide me with setting up python-oauth2? Am I missing something basic here?
You need to install Distribute, which is a fork of setuptools that supports Python 3.
That said, your syntax error was because python-oauth2 doesn't seem to run on Python 3 yet, so you need to either help port it, or use Python 2.7.
Related
I just downloaded Spyder IDE for my programming class. I had been using Replit for two months, so I figured this is high time I switched to Spyder.
The console shows this message:
"This version of python seems to be incorrectly compiled
(internal generated filenames are not absolute).
This may make the debugger miss breakpoints.
Related bug: http://bugs.python.org/issue1666807"
NOTE: I had installed Python a year ago using Atom, but then today, before installing Spyder, I deleted Python and all files related to it. Then, I downloaded latest version of Python from Python's website (3.10.1).
I tried to find a work around for this by going to preferences, Python interpreter, and selecting the interpreter I downloaded, which is named Python IDLE. But, every time I try selecting that, it says invalid file path (/Applications/Python 3.10/IDL
I tried looking this up, but I cannot find something that is beginner-friendly. Can someone help me understand what is causing this?
I tried to add conda-forge as prioritized channel, and I created new environment to install python and spyder-kernel again.
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install
https://conda-forge.org/#about
I was thinking about clear my default 'base' environment, but that does not work well. Thus, I had to create new environment.
conda create --name myenv
https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands
After that I have to indicate new Python Interpreter on 'Preferences - Python Interpreter - Use the following Python Interpreter'.
Then, it works for now, but I have to install additional packages for my convenience later.
In conclusion, I can have Spyder application running through Rosetta 2 with Python Interpreter for Apple Silicon.
Python 3.10.2 | packaged by conda-forge | (main, Jan 14 2022, 08:04:21) [Clang 11.1.0 ]
Type "copyright", "credits" or "license" for more information.
IPython 8.0.1 -- An enhanced Interactive Python.
My answer might be so rough, so please let me know how can I improve.
I have been using a google colab template for iterative LQR that uses the Pydrake, however, it seems like the code repository is removed and I can't reinstall it on google Colab:
try:
import pydrake
import underactuated
except ImportError:
!curl -s https://raw.githubusercontent.com/RussTedrake/underactuated/master/scripts/setup/jupyter_setup.py > jupyter_setup.py
from jupyter_setup import setup_underactuated
setup_underactuated()
# Setup matplotlib backend (to notebook, if possible, or inline).
from underactuated.jupyter import setup_matplotlib_backend
plt_is_interactive = setup_matplotlib_backend()
File "/content/jupyter_setup.py", line 1
404: Not Found
^
SyntaxError: invalid syntax
I tried clicking this link https://raw.githubusercontent.com/RussTedrake/underactuated/master/scripts/setup/jupyter_setup.py, and the page is not found... everything was working fine yesterday
Sorry. You're correct... I updated it this morning, and don't have a good deprecation policy in place on that repo, and this setup script is two versions ago. The path you want is https://raw.githubusercontent.com/RussTedrake/underactuated/master/setup/jupyter_setup.py
(remove the script from the directory). But if you look at that file, you'll see that even that is pointing to an updated setup script which you might want to point to.
This is actually all good news... we are on the path to a much better solution. You can now just pip install drake on colab (see the drake installation guide). Once I land the pip install underactuated (probably in time for my Spring offering of the class), then all of that nasty setup will be gone.
I am following the instructions in the textbook of the course 6.832, appendix A, on how to install Drake locally on Linux.
All the installation steps have completed and seems to be successful. In addition, I have installed all the prerequisites as described. However, when I run the test in section 2.3
(python -c 'import pydrake; print(pydrake.__file__)')
I have experienced several errors.
It seems that it is trying to access older version of several lib***.so files than what I have.
F.eks: Pydrake tried to include libgfortran.so.3, when I only have libgfortran.so.4 on my computer. I tried to do some "hackfixes" by using the ln -s command to make the terminal accept "libgfortran.so.4" as "libgfortran.so.3". But, now I ran into another error that I don't know how to solve.
It says:
Traceback (most recent call last): File "", line 1, in
File
"/opt/drake/lib/python2.7/site-packages/pydrake/init.py", line 32,
in from . import common File
"/opt/drake/lib/python2.7/site-packages/pydrake/common/init.py",
line 3, in from ._module_py import * ImportError:
/opt/drake/lib/python2.7/site-packages/pydrake/common/../../../../libdrake.so:
undefined symbol:
_ZN6google8protobuf2io17CodedOutputStream28WriteVarint32FallbackToArrayEjPh
How do I handle this problem?
If you followed section A.2.1 "download the binaries" verbatim, you would be downloading https://drake-packages.csail.mit.edu/drake/continuous/drake-latest-xenial.tar.gz, the package for Ubuntu 16.04 (Xenial), which links to libgfortran.so.3.
Since you are on Ubuntu 18.04 (Bionic), you would instead need to download https://drake-packages.csail.mit.edu/drake/continuous/drake-latest-bionic.tar.gz, which links to libgfortran.so.4.
I am attempting to python3 proof my work and spyder seems to be having an issue with absolute_import.
For demonstration purposes I created two simple files. caller and callme
caller
from __future__ import absolute_import
from .callme import helloWorld
def runme(msg):
helloWorld(msg)
if __name__ == "__main__":
runme('It worked!')
callme
def helloWorld(msg):
print("helloWorld's message is '{}'".format(msg))
if __name__ == "__main__":
helloWorld('Hi')
When attempting to run caller from spyder I get the following error:
ValueError: Attempted relative import in non-package
Running from ipython via the anaconda prompt (python 2) or from jupyter notebook (running python3 or python2) both work properly.
Ideas on how to fix spyder's behavior so it properly recognizes absolute_import?
Spyder versions tried:
3.2.4 Python 2.7.14 64bits, Qt 5.6.2, PyQt5 5.6 on Windows 10
3.3.2 Python 2.7.14 64-bit | Qt 5.6.2 | PyQt5 5.6 | Windows 10
Update
Updating spyder via conda update spyder (now version 3.3.2) did not fix the issue.
If you run python caller.py in a system terminal, you'll get exactly the same error as the one you posted, i.e.
ValueError: Attempted relative import in non-package
So this is not a problem with Spyder (because Spyder runs something similar to python caller.py when you execute a file with Run > Run), but with the way relative imports works.
Please see this answer for a proper explanation:
https://stackoverflow.com/a/11537218/438386
In essence, you can't use relative imports in scripts.
Note: There's a workaround to avoid this error, as described in this answer:
https://stackoverflow.com/a/11536794/438386
However, we don't have the ability to execute a script as a package in Spyder, sorry.
I downloaded the bullet3 github repository (Bullet Physics SDK) from https://github.com/bulletphysics/bullet3.git which contains python bindings for OpenAI Gym examples to run Reinforcement Learning Algorithms.
I tried running the kuka_grasp_block_playback.py example present in the following directory: bullet3-master/examples/pybullet/examples/
My system does not support pybullet.GUI and so I went ahead with pybullet.DIRECT.
But, on running it using python kuka_grasp_block_playback.py, its giving me the following error:
Traceback (most recent call last):
File "kuka_grasp_block_playback.py", line 92, in <module>
stepIndex = int(p.readUserDebugParameter(stepIndexId))
pybullet.error: Failed to read parameter.
How to deal with this ?
This is an out-of-date question, but just in case:. the latest version of pybullet contains a similar KUKA grasping implementation as OpenAI Gym environment. Just run 'sudo pip install pybullet' to get it.
This gym environment can be run without GUI without issue. See the quickstart guide at http://pybullet.org for more info about those pybullet Gym environments for Deep Reinforcement Learning.
The readUserDebugParameter only executes when using GUI mode, it fails in DIRECT mode, so just comment it out.