lördag 20 augusti 2016

github: fork, clone and sync

Problem: We have forked a repo. It's been updated and our fork is not in sync.

I assume that we have cloned the original repo to a local machine, and that we have added our private fork to the local clone. With mopidy repo as example (see also mopidy docs):

Creating local clone (creates a new folder - mopidy), and rename origin with upstream:
git clone https://github.com/mopidy/mopidy.git
git remote rename origin upstream

Check remote info:
git remote -v
>upstream https://github.com/mopidy/mopidy.git (fetch)
>upstream https://github.com/mopidy/mopidy.git (push)

Add privat github repo of mopidy:
git remote add alexjaw git@github.com:alexjaw/mopidy.git

Check remote info:
git remote -v
>alexjaw git@github.com:alexjaw/mopidy.git (fetch)
>alexjaw git@github.com:alexjaw/mopidy.git (push)
>upstream https://github.com/mopidy/mopidy.git (fetch)
>upstream https://github.com/mopidy/mopidy.git (push

Fetch to local clone (does not affect the local clone):
git remote update
>...

Merge updates in branch develop from original repo mopidy/mopidy (upstream):
git pull upstream develop

Finally, update your private repo branch develop (on Github):
git push alexjaw develop

Check on Github that the private repo is in sync with original repo.

söndag 14 augusti 2016

workon not found

virtualenvwrapper is handy for admin of envs. But some times workon is not longer recognized by the shell - workon: command not found.

A dirty way to handle this is to use the path of the virtual env. For mopidy I use:

source ~/Env/mopidy/bin activate

Deactivate as usaul with deactivate.

There is a SO discussion about this, see here.

A BETTER way is to add some info to ~/.bashrc as explained in the docs.
# load virtualenvwrapper for python
export WORKON_HOME=$HOME/Envs
export PROJECT_HOME=$HOME/mopidy-dev
source /usr/local/bin/virtualenvwrapper.sh

Folder Env will contain the virtual envs.

fredag 12 augusti 2016

scipy installation on raspberry pi

Have tried to install scipy on wheezy and jessie with pip without success (could only install numpy with pip). However, it's easy to install with

    sudo apt-get update
    sudo apt-get install python-scipy

Observe that the first time you try to install the package you might get the message

    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Running the following command fixed the problem

    sudo apt-get --fix-missing

The versions installed were

  • numpy 1.8.2
  • scipy 0.14.0


apt-get and pip

Often both can be used when installing python packages. If apt is used, the installed python package will still be visible when using "pip list".

One issue with apt is that the package versions might be somewhat old.

Example (raspberry pi running debian jessie):
sudo pip install pyserial, pip list says pyserial 3.1.1

sudo apt-get install python-serial, pip list says pyserial 2.6