I installed git for windows and it works fine(e.g. use one of the following solutions Want to download a Git repository, what do I need (windows machine)?).
I tried to use repo of google but it needs gpg and python 2.7. I installed both and it works fine the only problem is that repo script use some unix oriented features such as symbolic links and fcntl. Is there any alternative code of repo for windows?
I couldn't found some native solution by google. if there is one I'll try to push it into google repo git repository or try to use it as is.
Yes, Google repo script can be compliant with Windows. Follow the steps below.
But before, as Borealid said repo as not been ported on Windows. repo (forall.py) uses fcntl that is not available on Windows (Unix only).
However there is Cygwin and its own python and git tools.
If git version from MSysGit project for you or if you love your git GUI that is based on MSysGit only, then follow the following steps. These steps ensure that Cygwin can create native NTFS symlinks. Else if the git from Cygwin is sufficient, you do not have to do it. But it is better as setting CYGWIN=winsymlinks:native tells Cygwin to use native NTFS symlinks instead of old Cygwin workaround.
Use Windows Vista or later (or switch to Linux)
Have Admin privileges
Dowload and install Cygwin (32 or 64 bits)
Select and install python and git (and gpg if you want) from Cygwin installer
Set CYGWIN=winsymlinks:native in your Cygwin shell:
export CYGWIN=winsymlinks:native
mkdir NEW_DIR
cd NEW_DIR
repo init -u YOUR_URL
repo sync -j 7
(see also my other post)
A working repo tool for windows is available here: https://github.com/esrlabs/git-repo
It requires Python 3+ and git 1.7.2+
Btw, the original forked repo version seems pretty old, so it might not contain all current functionalities.
There is an alternative for whoever has a choice to work with an alternative to repo, it's called gclient.
See Google's depot tools:
gclient: Meta-checkout tool managing both subversion and git
checkouts. It is similar to repo tool except that it works on Linux,
OS X, and Windows and supports both svn and git. On the other hand,
gclient doesn't integrate any code review functionality.
There is no native repo for Windows currently.
You may use a Linux virtual machine or dual-boot, or work around the (relatively minor) issues caused by symlinks not functioning on your filesystem.
Another option would be to just use git directly instead of using the repo as a convenience wrapper - repo is a support tool, and doesn't add any substantial power.
Related
I've been searching around the Internet for a while but I have not been able to find detailed instructions on how to install Polynote (The polyglot notebook
with first-class Scala support.) for Windows with mixing multiple languages, Python and Scala.
Github Link for Polynote.
Official Website.
According to Official Website:
Polynote is currently only tested on Linux and MacOS, using the Chrome browser as a client. We hope to be testing other platforms and browsers soon. Feel free to try it on your platform, and be sure to let us know about any issues you encounter by filing a bug report
I would really appreciate it if anyone here can share his/her method if he/she
had successfully installed Polynote on Windows, either from Virtual Machines
(VMware/Virtualbox) or directly.
You could install Polynote on Windows with Ubuntu's subsystem for Windows. To do that, you have to:
Enable Windows Developer mode: Settings > Update & Security > For Developers > Developer Mode.
On Windows Features turn on Windows Subsystem for Linux.
Search for Bash on Ubuntu on Windows in your local search and you will find it.
Otherwise, you can skip the third step by installing Ubuntu 18.0.4 LTS from Window Store which is free and you can run linux commands there. You can actually install any Linux software and it works just as if it was native.
Having installed Ubuntu for Windows, you can just go through the steps on official documentation through the link which you provided us and you will be fine.
Might be a bit late but still maybe helpfull if you can't on WSL or if you easily want to keep polynote up-to-date.
I used docker to run polynote on Windows. Currently I'm reworking the Dockerfile I wrote to automatically update polynote on new releases. But as of now the script to run Polynote works for polynote version (0.3.11). https://github.com/moritzbaumotte/polynote-windows-inofficial
Here you only need docker-compose and docker installed. You can download the repository and execute the batch script. It will create a working docker image and run it, then you can access polynote on http://localhost:8192
The issue with the official docker images imo is the binding to 127.0.0.1 which needs to be 0.0.0.0, hence the config.yml in my repository.
I have just acquired a stand alone PC running XP, and I do not want to connect to the internet. I am running python 2.7 on my laptop and was wondering if there was a way to install the python.exe file to a flash drive so I can install python 2.7 on the stand alone. The download from the python.org website goes straight to the path in my c drive, and will not let me save it to the flash drive. I have tried installing from active state, and I am unable to use this as it is not win32. Any help will be much appreciated.
You can download python's zip file then unzip it onto your flash drive, here's the link for the latest release of python 3.6.1 with win32 including all the components that python is required to run as well as the python.exe that you wanted:
https://www.python.org/ftp/python/3.6.1/python-3.6.1-embed-win32.zip
Here's the link to the downloads page, if you wanted another version of python, look for Download Windows x86 embeddable zip file.
If you want a clean, standard CPython installation without bells and whistles on your offline Windows XP machine, you can use your flash drive to transport a Python 2.7 installer from python.org to your Windows XP machine's local hard drive, and then run the installer from there. It could be somewhere between inconvenient and difficult to install third-party packages (as you would find on PyPI) without the full benefit of pip. (Depending on the specific packages you want, you may be able to transport installers or wheels and still use pip in offline mode, without automatic dependency installation.)
If you want a full-featured but potentially big "portable" installation that you can just plop into any directory and use from there, you can try an old version of Portable Python (the project is defunct but the download page is still up as of this writing) or WinPython (note that this answer suggests sticking with 2.7.9 or earlier).
I'm looking to create the following:
A portable version of python that can be run on any system (with any previous version of python or no python installed) and have it pre-configured with various python packages (ie, django, lxml, pysqlite, etc)
The closest I've found to the above is virtualenv, but this only goes so far.
If I package up a nice virtualenv for python on one machine, it contains sym links to a lot of the libraries it needs. I can take those sym links and convert them to their actual files, but if I try to move this entire directory to another machine, I get seg fault after seg fault.
To launch python on a different machine, I'm using:
LD_LIBRARY_PATH=lib/ ./bin/python
and in lib/ I have all of the shared libraries I copied from the original machine. The problem here is these shared libraries might rely on other shared libraries that I'm not including, so executing this on other linux distros does not work. Probably due to it falling back on older shared libaries installed on the system that do not work with what I copied over.
Anyone have an idea on how to get this working? Is this even possible?
EDIT:
To clarify, the desired outcome is to create a tar.gz of a python binary and associated packages (django, lxml, pysqlite, etc) that can be extracted and run on any linux based system, ie (ubuntu 8.04, redhat 5, suse 11, etc), all 32bit distros, where the locally installed version of python doesn't impact what's in the tar.gz.
I just tested this and it works great.
Get the copy of python you want to install and untar it and cd to the untarred folder first.
Also get a copy of setuptools and untar that.
/opt/portapy used below is of course just the name I came up with for this post, it could be any path and the full path should be tarred up and the same path should be used on any systems you put this on due to absolute path linking.
mkdir /opt/portapy
cd <python source dir>
./configure --prefix=/opt/portapy && make && make install
cd <setuptools source dir>
/opt/portapy/bin/python ./setup.py install
Make the virtual env folder inside the portapy folder.
mkdir /opt/portapy/virtenv
/opt/portapy/bin/virtualenv /opt/portapy/virtenv
cd /opt/portapy/virtenv
source bin/activate
Done. You are ready to install all of your libraries here and have the option of creating multiple virtual envs this way.
You can then tar up the whole /opt/portapy folder and transport it to any Linux system of the same arch, within reason I suspect.
I compiled 2.7.5 ond centOS 5.8 64bit and moved the folder to a Cent6.9 system and it runs perfectly.
I don't know how this is even possible. If it were, they woudn't need to distribute binary packages of python for different platforms. You can't simply distribute python that will run on any platform. It has to be built from source for that arch. Virtualenv will expect you to tell it which system python to use (using links).
This pretty much goes for almost any binary package that links against system libs. Again, if it were possible, we wouldn't need any platform specific binary distributions.
You can, however, achieve part of what you want. That is, running python on another machine that doesn't have python installed as long as its the same arch. This is the same concept behind freezing, or py2exe/py2app/pyinstaller. An interpreter is bundled into a standalone environment. So the app can run on any similar platform.
Edit
I just realized that while your question speaks about "system" agnostically, your title contains the reference "linux". There are different flavors of linux, so in order for it to work you would have to build it fat for multiple archs and also completely contain the standalone links. You might try building a package with pyinstaller and using that to include in your project.
You can try just building python from source, in your virtualenv:
$ ./configure --prefix=/path/to/virtualenv && make && make install
If you still have problems with the links to libs, you can also investigate building it statically
I'm not sure that working solely in Python is the way to go here. You might have better luck with Puppet of Chef, which are configuration tools that can be used to create a local environment. There is plenty of code out there to install virtualenv and python on just about any Linux plus OSX (probably not Windows though).
Your workflow would be to install chef or Puppet (your choice), run a script to install the Python you want, then enter a virtualenv and pip install any packages you might need.
Sorry this isn't as easy as virtualenv alone, but it is much more robust.
Well, since I rarely accept "can't be done", there is a way to do it. Warning: it isn't pretty and you should probably look into a different scenario.
What you will need to to is determine a standard location for this top level directory. Second, using that directory as your root you will need to compile Python on each Linux distribution you want to run this on. For this you would use something like "/usr/local/myappname/platform/" to configure and compile Python to live in. In each case substitute "platform" with the name of the platform such as "/usr/local/rhel/". If memory serves the configure option you are looking for here is --prefix.
Once you have each distribution compiled you will need a script to determine which one to use and either set environment variables or have it create symlinks to the appropriate "installation" of python. I would then use virtualenv and bootstrap in that tree to keep the "in-use" python libraries even more specific.
I can't think of a common Linux distribution that doesn't have Python by default. As such you could use setup.py and/or basic python scripts to script this out since you should be able to rely in Python being present - even if its ye olde version as in RHEL installs. Personally I find the above method overly complicated but it would meet your stated requirements with the allowance for a final script. Of course, you could use shar (SHell ARchive) to tar all of this into a runnable shell script to do the installation and avoid the need for secondary scripts. If you gzip the resulting shel archive then you can decompress it on target systems and execute it to set everything up.
All that said, I would not recommend this. I would recommend determining the minimum Python version you can run on and ensuring that is installed by the distribution whenever possible and if needs be pulling down from a repo and installing. Then, use virtualenv and bootstrap with a requirements.txt to install necessary python libraries and apps into the virutalenv. For that see this documentation
I faced the same problem, so I created PortableVirtualenv. Your Question is just the definition of it.
I use it as a base for commercial multiplatform app I develop. (But PortableVirtualenv is public domain - use it freely.)
If needed, you can pip-install any package and zip the whole directory to distribute also packages you need.
One nice option is to make a "snap" portable linux application. They have a python mode which lets you specify you specify exactly what modules you need. From https://snapcraft.io/first-snap#python :
Snaps let you distribute a dependency-isolated Python app in an app store experience for end users.
Another option is to containerize your application with something like docker. Then instead of executing your script directly, the user is actually running a small OS with just your application and its dependencies. https://www.infoq.com/articles/docker-executable-images/ has more about executable containers.
Container images can also be used for short lived processes: a containerized executable meant to be run on your computer. These containers execute a single task, are short lived and can generally be removed after use. We call these executable images. Examples are compilers (Golang) or build tools (Maven), presentation software (I love to hack a simple presentation in Markdown format and let a RevealJS Docker image serve that) and browsers (a fresh contained browser to follow that fishy link). A real evangelist for executable images is Docker's own Jessie Frazelle. To get some great inspiration be sure to read her blog about them or check out this presentation at DockerCon 2015.
Can I install Pinax on Windows Environment?
Is there a easy way?
Which environment do you recommend?
I have pinax 0.7rc1 installed and working on windows 7, with no problems.
Check out this video for a great example on how to do this. He uses pinax 0.7beta3 on windows XP.
http://www.vimeo.com/6098872
Here are the steps I followed.
download and install python
download and install python image library
download pinax at http://pinaxproject.com
extract the download to some working directory <pinax-directory> (maybe c:\pinax ?)
make sure you have python in your path (c:\pythonXX)
make sure you have the python scripts folder in your path (c:\pythonXX\scripts)
open a command prompt
cd to <pinax-directory>\scripts folder
run python pinax-boot.py <pinax-env> (I used "../pinax-env")
wait for pinax-boot process to finish
-- technically pinax is installed and ready to use, but the next steps will get you up and running with pinax social app (any other app will also work fine)
cd to your <pinax-env>\scripts directory
execute the activate.bat script
execute python clone_project social <pinax-env>\social
cd to <pinax-env>\social
execute python manage.py syncdb
execute python manage.py runserver
open your browser to the server and you should see your new pinax site
Voila!! Pinax on Windows.
Provided you have Python and Django installed, Pinax should install fine. According to the documentation there is one step that you have to do specifically on Windows however (Under the "Note To Windows Users" heading):
http://pinaxproject.com/docs/0.5.1/install.html
I spent a while trying to get the .7 beta working in Windows and ran into a lot of trouble. However, it looks like the 3rd beta release of .7 (the latest beta release) focuses on Windows support. So try that, instead of the 'stable' version - it's close to being released as stable anyway, and is recommended now for use.
In the end though, I switched to Ubuntu and haven't been happier. Python development is much nicer in Linux. It's easier to install many Python packages, I run into fewer configuration issues, and there's better support and documentation available.
I need to write, or find, a script to create a Debian package, using package python-support, from a Python package. The Python package will be pure Python without C extensions.
The Python package for testing purposes will just be a directory with an empty __init__.py file and a single Python module, package_test.py.
The packaging script must use python-support to provide the correct bytecode for possible multiple installations of Python on a target platform, i.e. v2.5 and v2.6 on Ubuntu 9.04 (Jaunty Jackalope).
Most advice I find while googling are just examples of nasty hacks that don't even use python-support or python-central.
I have spent hours researching this, and the best I can come up with is to hack around the script from an existing open source project, but I don't know which bits are required for what I'm doing.
Has anyone here made a Debian package out of a Python package in a reasonably non-hacky way?
I'm starting to think that it will take me more than a week to go from no knowledge of Debian packaging and python-support to getting a working script. How long has it taken others?
The right way of building a .deb package is using dpkg-buildpackage, but sometimes it is a little bit complicated. Instead you can use dpkg -b <folder>, and it will create your Debian package.
These are the basics for creating a Debian package with dpkg -b <folder> with any binary or with any kind of script that runs automatically without needing manual compilation (Python, Bash, Perl, and Ruby):
Create the files and folders in order to recreate the following structure:
ProgramName-Version/
ProgramName-Version/DEBIAN
ProgramName-Version/DEBIAN/control
ProgramName-Version/usr/
ProgramName-Version/usr/bin/
ProgramName-Version/usr/bin/your_script
The scripts placed at /usr/bin/ are directly called from the terminal. Note that I didn't add an extension to the script. Also you can notice that the structure of the .deb package will be the structure of the program once it's installed. So if you follow this logic, if your program has a single file, you can directly place it under ProgramName-Version/usr/bin/your_script, but if you have multiple files, you should place them under ProgramName-Version/usr/share/ProgramName/all your files and place only one file under /usr/bin/ that will call your scripts from /usr/share/ProgramName/.
Change all the folder permission to root:
chown root:root -R /path/to/ProgramName-Version
Change the script's permissions:
chmod 0755 /path/to/the/script
Finally, you can run: dpkg -b /path/to/the/ProgramName-Version and your .deb package will be created! (You can also add the post/pre install scripts and everything you want. It works like a normal Debian package.)
Here is an example of the control file. You only need to copy-paste it in to an empty file called "control" and put it in the DEBIAN folder.
Package: ProgramName
Version: VERSION
Architecture: all
Maintainer: YOUR NAME <EMAIL>
Depends: python2.7, etc , etc,
Installed-Size: in_kb
Homepage: http://example.com
Description: Here you can put a one line description. This is the short Description.
Here you put the long description, indented by one space.
The full article about Debian packages can be read here.
I would take the sources of an existing Debian package, and replace the actual package in it with your package. To find a list of packages that depend on python-support, do
apt-cache rdepends python-support
Pick a package that is Architecture: all, so that it is a pure-Python package. Going through this list, I found that e.g. python-flup might be a good starting point.
To get the source of one such package, do
apt-get source <package>
To build it, do
cd <packagesrc>
dpkg-buildpackage -rfakeroot
When editing it, expect that you only need the files in the debian folder; replace all references to flup with your own package name.
Once you get started, it should take you a day to complete.
I think you want http://pypi.python.org/pypi/stdeb:
stdeb produces Debian source packages
from Python packages via a new
distutils command, sdist_dsc.
Automatic defaults are provided for
the Debian package, but many aspects
of the resulting package can be
customized (see the customizing
section, below). An additional
command, bdist_deb, creates a Debian
binary package, a .deb file.
Most of the answers posted here are outdated, but fortunately a great Debian wiki post has been made recently, which explains the current best practices and describes how to build Debian packages for Python modules and applications.
http://wiki.debian.org/Python/Packaging
First off, there are plenty of Python packages already in Debian; you can download the source (including all the packaging) for any of them either using apt-get source or by visiting http://packages.debian.org.
You may find the following resources of use:
Debian New Maintainer's Guide
Debian Policy Manual
Debian Python Policy
Debian Python Modules Team