Fixing Windows Issues
Installing Jupyter Notebook (formerly IPython Notebook)
Installing zeromq, a prerequisite
If you try to run pip install jupyter
you get a series of errors. The error might look something like this:
Building 'zmq.libzmq' extension
creating build/tmp.cygwin-1.7.35-i686/bundled/zeromq
creating build/tmp.cygwin-1.7.35-i686/bundled/zeromq/src
gcc -Who-unused-result .....etc
.......
gcc: error: spawn: No such file or directory
error: command 'gcc' failed with exit status 1
....failed with error code 1 in /tmp/pip-build-5989xxnp/pyzmq/
Now we’re going to fix it! In Babun, run the following code to install the zeromq library, as well as the Python bindings for zeromq:
IMPORTANT: See the marks around
uname -m
below? They’re backticks, not single quotes.
pact install mingw64-`uname -m`-zeromq
pact install python3-zmq
IF you run Jupyter immediately, you’ll see a few weird errors. Let’s fix that by rebasing! I don’t know what rebasing does, honestly, but it fixes it.
- Close all Babun windows
- run
cmd
/Command Prompt from the start menu - Once it’s opened, run
cd .babun/cygwin/bin && dash.exe -c '/usr/bin/rebaseall -v'
- If it looks okay, type
exit
Installing Jupyter Notebook
Open up babun again and run the following
pip3 install jupyter
Now try to run jupyter notebook --no-browser
, and then open up localhost:8888 in the browser of your choice! Success??
Strange characters in psql
First you need to change the font in Command Prompt, then you’ll need to change the default character settings for psql
.
1. Changing the font in Command Prompt
- Open up Command Prompt (
cmd
) - NOT babun - Click the icon in the upper left, and go to
Defaults
- Click the
Font
tab, selectLucida Console
as the font, and change theSize
to14
because you’ll probably be happier that way - Click
OK
and close the Command Prompt.
2. Changing the default character settings for psql
Open up Atom, and paste the following into a new file.
@echo off
REM Copyright (c) 2012-2016, EnterpriseDB Corporation. All rights reserved
REM PostgreSQL server psql runner script for Windows
SET server=localhost
SET /P server="Server [%server%]: "
SET database=postgres
SET /P database="Database [%database%]: "
SET port=5432
SET /P port="Port [%port%]: "
SET username=postgres
SET /P username="Username [%username%]: "
for /f "delims=" %%a in ('chcp ^|find /c "932"') do @ SET CLIENTENCODING_JP=%%a
if "%CLIENTENCODING_JP%"=="1" SET PGCLIENTENCODING=SJIS
if "%CLIENTENCODING_JP%"=="1" SET /P PGCLIENTENCODING="Client Encoding [%PGCLIENTENCODING%]: "
chcp 65001
SET client_encoding='UTF8'
REM Run psql
"C:\Program Files\PostgreSQL\9.5\bin\psql.exe" -h %server% -U %username% -d %database% -p %port%
pause
Save the file as psql-utf8.bat
(somewhere accessible, like your desktop.). By making sure it’s a .bat
file, it will run all of the commands inside every time you run it.
Every time you want to run psql
, run this new .bat file instead. Then you won’t have problems with accents and the like.
NOTE: This isn’t a perfect solution, there are still a few things that seem off. It gets you 90% of the way there, though.
3. Testing it out
Run psql
using the new file, cross your fingers, look at some text that was previously crazy looking.