Okay, so I am trying to generate and deploy the documentation of a Python 2.7 based package. The documentation is generated using sphinx, python 2.7.
However, to actually deploy the documentation, I need to use a tool called doctr. This automatically deploys the generated html to github pages. However it requires me to work on Python 3.5 or newer.
So the question is : When the entire travis build is running on python 2.7, how do I temporarily shift to python 3.5 and deploy the documentation?
You can use pyenv to install 3.5 if not already present, and change to it, do your thing, and change back.
Basically this;
pyenv install 3.5.0
pyenv global 3.5.0
<do the deploy>
pyenv global <previous version>
Related
I have just installed repo on my machine.
When I run repo to check whether repo is installed properly, there's a warning:
$ repo
warning: Python 3 support is currently experimental. YMMV.
Please use Python 2.6 - 2.7 instead.
error: repo is not installed. Use "repo init" to install it here.
I added the installation path of repo and python to the user environment.
Please tell me how to use python 2.7 when I need to run repo. Meanwhile, there are some tools that need to run with python 3.6 also.
Modern versions of repo (that is, the 2.x series) support Python 3 just fine, and in fact, do not support Python 2 at all, according to the documentation. It looks like you're using an older version that wants Python 2, so you should upgrade to a newer version.
Since Python 2.7 is now end of life, it's not a good idea to use it for anything anymore since it receives no security updates.
We need to use an external library which only runs on Python 3.6 or higher. Unfortunately, HDInsight only has Python 3.5 installed by default.
Is there a way to upgrade the minor version for Python on HDInsight?
The official Azure documentation does not mention about it.
https://learn.microsoft.com/en-us/azure/hdinsight/spark/apache-spark-python-package-installation
As stated in Microsoft Q&A:
It's not recommended as using non-cluster built-in Python versions are unsupported scenario.
WARNING!: HDInsight cluster depends on the built-in Python environment - Python 3.5. Directly installing custom packages in those default built-in environments may cause unexpected library version changes. And break the cluster further.
If you want to install, you can use Python 3.6, change “python=3.5” in this command to python=3.6, and follow the rest steps in the document works.
sudo /usr/bin/anaconda/bin/conda create --prefix /usr/bin/anaconda/envs/py36new python=3.6 anaconda –yes
I'm trying to follow the instructions here but no matter what I do it seems to be stuck on using Python 2.7.1 which is causing me errors currently.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-osx.html
Attached is an image showing my logs of upgrading to the newest awsebccli but its still stuck saying 2.7.1 when it should say 3.6 (or newer)
What could I be doing wrong?
I want to note that I also installed the newest version of python3 and python via brew.
Here is the exact error I'm getting if it helps also.
You do not want to upgrade the default python 2.7x installation or the python 3.x installation available on linux or OSX. There are usually lots of other libraries and applications that depend on this default installation. When you want to use a specific version of python the approach is to rely on a virtual enviorenment.
virtualenv is a tool to create isolated Python environments.
You are then leaving the system installation untouched. Getting the hang of virtualenv is quite easy. Once you create it (a one off task). All you need is to activate it and then you can use it as you would normally use the default python interpreter. How to copy packages from one virtualenv (or the system installation) to another is discussed here:
Installing python3 in a python2 virtual environment
FIRST QUESTION:
I was using python 2.7, but I started learning web scraping and the tutorial I read use python 3.5. So I installed python 3.5 and pip for that. After I installed scrapy I cannot run my project using
scrapy crawl mywork
it reports an error like this:
ImportError: cannot import name '_win32stdio'
And then I read that python 3.5 with scrapy is now not supported on windows, but Ubuntu. So I want to ask if there is any configuration that I didn't know?
SECOND QUESTION:
And in order to avoid the problem I want to go back to python 2.7 and installing scrapy for 2.7.
It is not hard to differentiate pip for 2.x and 3.x version by
py -2 -m pip isntall thePackage
But the PROBLEM is that after I installed python 3.5 and pip for 3.5,
I cannot use pip for py2.7 anymore. It seems that I cannot link to the url for python 2.7 or something like that.
Whatever package I am installing in 2.7, it goes like
Could not fetch URL https://pypi.python.org/.../: There was a problem
confirming the ssl certificate: [Erron 185090050] _ssl.c:344 ...
....
Cannot fetch index base URL https://pypi.python.org/simple/
....
Could not find any downloads that satisfy the requirement pip in c:\python27\lib\site-packages\pip-1.5-py2.7.egg
I do love python but the installing pakcages part is really annoying
Regarding your issue using pip, you need to check and modify your environment variables:
https://docs.python.org/2/using/windows.html
3.3.1. Excursus: Setting environment variables Windows has a built-in dialog for changing environment variables (following guide applies to
XP classical view): Right-click the icon for your machine (usually
located on your Desktop and called “My Computer”) and choose
Properties there. Then, open the Advanced tab and click the
Environment Variables button.
In short, your path is:
My Computer ‣ Properties ‣ Advanced ‣ Environment Variables In this
dialog, you can add or modify User and System variables. To change
System variables, you need non-restricted access to your machine (i.e.
Administrator rights).
Otherwise, remove pip and reinstall, as it might be related to the pip version you have (pip connection failure: cannot fetch index base URL http://pypi.python.org/simple/)
as per why scrapy is not woking using python 3.5 - this questionn has already been answered here: Error installing scrapy in python 3.5
and from a comment in this post:
Until Twisted supports Python 3.5 which it does not it will not work
on windows.
– #Chris Hawkes
(Based on this answer)
You can install Twisted on Python 3.5 by using the whl from here. Then try installing Scrapy again.
I've installed Python 2.7 using macports and because of my $PATH variable, that's the one I get when I type $ python. However, virtualenv defaults to using Python 2.6 unless I remember to force it to do otherwise with the -p flag.
On a related note, globally running yolk -l shows the following:
Python - 2.6.1 - active development (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload)
So my question is, should I do something to ensure the system is always using MacPorts' Python 2.7 or is it not worth worrying that Apple's Python 2.6.1 is apparently in the mix?
If you force python 2.7 globally on your system, things will break. You don't want to do that.
You should use virtualenvwrapper. It should choose your preferred python.
http://www.doughellmann.com/docs/virtualenvwrapper/install.html#python-interpreter-virtualenv-and-path
I have had similar problems, although not related specifically to virtualenv. I found that, after installing a particular version of python with macports, and having that version set as default, installing 3rd party modules that are build on or use python using macports solved all problems. You essentially end up with parallel builds, on top of different versions of python. I have a few, and switch between them using python_select. Also, see here on SO for how to get easy_install to work with your new python.