Install swift 4 on bash on Ubuntu on Windows 10 - swift

I try to install Swift 4 on bash on Ubuntu on Windows 10
My version of Ubuntu:
me#DESKTOP:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
I did apt-get upgrade and apt-get update
I follow Linux steps here: to install Swift 4
Eventually I end up with the error:
me#DESKTOP:~$ swift
/home/me/swift4/swift-4.0.2-RELEASE-ubuntu16.04/usr/bin/lldb: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
I have python2 installed:
me#DESKTOP:~$ python2 --version
Python 2.7.12
I wonder how to make it works.

Installing libpython2.7 successfully resolves the error
$ apt-get install libpython2.7
However it still failed to launch the swift repl due to kernel permissions issue.
Using docker image (or Virtual Box like OP) is a better way to go.
reference
https://bugs.swift.org/browse/SR-2743

Related

python2.7 in Raspbian Lite

I have installed Raspbian Lite OS in Raspberry Pi zero.
I found that Raspbian Lite comes with Python3 as default.
But I am gonna run some scripts that uses libraries that are Python2 Compatible.
So I tried to change the default Python version from Python3 to Python2 (Specifically Python2.7.18)
After so much searching and trying, instructions from [this page][1] made my job
Now if I try to check in command writing
python --version
It shows me that it is Python2.7.18
But the problem is I am not being able to install any packages using
sudo apt-get install <python-packagename>
It shows me Errors like
1.Package "python-pip" has no installation candidate (When I tried to install pip)
2. Package python-numpy has no installation candidate (when I tried to install numpy)
3. unable to locate package python-pyaudio (when I tried to install pyaudio)
I am searching but no solution.
Can anyone please help? I am frozen in a critical stage of my project .
Generally, for new raspbian/raspios os with python 3 by default, it is not suggested to replace the system python interpreter to python 2, it may break some system component's dependency.
Instead, you can create a python 2 virtual env, if you need to run python2 scripts.
sudo apt-get install python3-pip
pip install virtualenv
virtualenv -p /usr/bin/python2.7 venv
source venv/bin/activate
You can test the python version as following,
(venv) $ python --version

Prebuilt sparc bare metal cross compiler not working

Downloaded a prebuilt cross compiler sparc-elf-4.2.2 and has set the PATH to sparc-elf-4.4.4/bin after which i ran sparc-elf-gcc -o matrixmul matrixmul.c on the terminal only to find the following response
/home/root/sparc-elf-4.4.2/bin/sparc-elf-gcc: No such file or directory
I have no idea as to why this response .
I just ran into the same problem. Turned out that that my OS is a 64-Bit Ubuntu System and the compiler is a 32-Bit program.
I followed the instructions given here https://askubuntu.com/questions/454253/how-to-run-32-bit-app-in-ubuntu-64-bit :
To run a 32-bit executable file on a 64-bit multi-architecture Ubuntu
system, you have to add the i386 architecture and install the three
library packages libc6:i386, libncurses5:i386, and libstdc++6:i386:
sudo dpkg --add-architecture i386
Or if you are using Ubuntu 12.04 LTS (Precise Pangolin) or below, use this:
echo "foreign-architecture i386" > /etc/dpkg/dpkg.cfg.d/multiarch
Then:
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
If fails, do also
sudo apt-get install multiarch-support
After these steps, you should be able to run the 32-bit application:
./example32bitprogram

How to install postgresql on Ubuntu 16.04 VM despite "unmet dependencies" to set up Ruby on Rails project

Ubuntu 16.04 on VirtualBox VM using Vagrant.
Windows 10 host.
Git Bash terminal.
Connected to vagrant up, vagrant ssh.
I have a fresh VM and have installed ruby and rails. I am trying to install postgresql to use for a Ruby on Rails project, but I get the following error:
vagrant#vagrant-ubuntu-trusty-64:~$ sudo apt-get install postgresql postgresql-contrib
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
postgresql : Depends: postgresql-9.6 but it is not going to be installed
postgresql-contrib : Depends: postgresql-contrib-9.6 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I've tried various things, and nothing seems to let me install postgres
I was facing same problem in my ubuntu 16.04
but i fixed that problem and it's very simple just follow these step and you will be able to install postgresql 10 in your system :
Add this to your sources.list:
sudo vim /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ wheezy main non-free contrib
deb-src http://ftp.de.debian.org/debian/ wheezy main non-free contrib
after that add these link to your pgdg.list file if it's not there you have to create and add link and save it.
sudo vim /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
then update your system
sudo apt-get update
sudo apt-get upgrade
and install that unmet dependencies :
apt-get install ssl-cert
that's it. now Install postgresql using these command
sudo apt-get install postgresql-10
#JosMac pointed out that I am running Ubuntu 14.04 instead of 16.04 as I had thought.
I was still running into similar errors, but I just ended up installing the rails-dev-box (https://github.com/rails/rails-dev-box) way which uses yakkety64, and seems to work.

Installing iCub (Humanid) simulator on Linux mint 17

Can anybody tell me the procedure for installing iCub (humanoid) simulator on Linux mint 17 operating system. It seems they have only got the instruction procedure for Linux version of Debian and Ubuntu on their website.
Thanks
Lekan
Linux Mint 17 is derived from Ubuntu 14.04. So you can use the same installation procedure for the Ubuntu to Linux Mint. Steps for the same are given below.
Open terminal and enter the following command.
sudo sh -c 'echo "deb http://www.icub.org/ubuntu trusty contrib/science" > /etc/apt/sources.list.d/icub.list'
sudo apt-get update
sudo apt-get install icub
For more information follow the link iCub Installation procedure for Linux

Installing psycopg2 into virtualenv when PostgreSQL is not installed on development system

Is it possible to install psycopg2 into a virtualenv when PostgreSQL isn't installed on my development system—MacBook Pro with OS X 10.6?
When I run pip install psycopg2 from within my virtualenv, I received the error shown below.
I'm trying to connect to a legacy database on a server using Django, and I'd prefer not to install PostgreSQL on my development system if possible.
Why not install PostgreSQL?
I received an error when installing PostgreSQL using homebrew. I have Xcode4—and only Xcode4—installed on my MacBook Pro and am thinking it's related to missing gcc 4.0. However, this is a problem for another StackOverflow question.
Update 8:37 AM on April 12, 2011: I'd still like to know if this is possible without installing PostgreSQL on my MacBook Pro. However, I ran brew update and forced a reinstallation of ossp-uuid with brew install --force ossp-uuid and now brew install postgresql works. With PostgreSQL successfully installed, I was able to pip install psycopg2 from within my virtualenv.
Error from pip install psycopg2
$ pip install psycopg2
Downloading/unpacking psycopg2
Running setup.py egg_info for package psycopg2
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
Complete output from command python setup.py egg_info:
running egg_info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/matthew/.pip/pip.log
Preliminary Research
Below are the articles I read as preliminary research:
Installing psycopg2 to use Django with PostgreSQL on OS X
Installing psycopg2 on OS X
Using psycopg2 with virtualenv on Ubuntu JauntyLucid
Postgres, psycopg2, virtualenv install hints
apt-get install libpq-dev
helped me on debian squeeze
From comments:
apt-get install python-dev-is-python3
psycopg depends on pg_config command, and if you don't have it, you can't install psycopg.
If system installation is a problem to you, why don't you try compiling PostgreSQL and including generated bin files in your $PATH? Like:
export PATH=/path/to/compiled/postgresql/bin:"$PATH"
pip install psycopg2
brew install postgresql
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip3 install psycopg2
apt-get install libpq-dev
helped me in debian squeeze too . After that do pip install psycopg2. I faced problem of pg_config not found problem when i was setting up my environment on heroku , now its working fine .
You need to install the python-dev package in order to make use of python extensions such as psycopg2. I don't know how to install packages in mac but I run the following commands to install a python package on my Ubuntu machine.
sudo apt-get install python-dev
Or
sudo apt-get install python3-dev
if you are using Python3.x.
Once the installation is finished run the following command within your virtual environment.
pip install psycopg2
You don't need the complete PostgreSQL installed: you only need the client side libraries.
I solved it in MAC OSX using :
$ wget https://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.bz2
$ tar xfv postgresql-9.5.3.tar.bz2
$ cd postgresql-9.5.3
$ ./configure
$ make
$ cd src/bin/pg_config
$ export PATH=`pwd`:"$PATH"
$ pip install psycopg2
Use pip install psycopg2-binary, it worked for me when pip install psycopg2 wasn't working.
Using the method you described in your April 12th update, I was able to install PostgreSQL(+1). Note that I originally was running Python 2.7.1 (32bit) and homebrew threw several errors and warnings regarding using a 32bit version of Python. I have since switched the 64/32 bit version of 2.7.1 and it works like a champ.
Regarding the pyscopg2, I was able to install it into my virtual environment from source by editing setup.cfg. I set pg_config to correct path inside homebrew's Cellar (pg_config=/usr/local/Cellar/postgresql/9.0.4/bin/pg_config). After saving the changes, I ran python setup.py install with zero issues. It's worth noting that I did not set the Mac's default python setting to 32 bit. I used the new 64 bit from start to finish.
After looking over some of the documentation, I think if I added homebrew's postgresql path to the system path I could have used pip to install it.
Reference:
http://favosdream.blogspot.com/2009/09/make-psycopg2-and-readline-work-in-snow.html
Update 6-8-2011:
While porting a project written on OS X to Windows 7, I found out that I had to install PostgreSQL on Windows as well. This ended up creating another user on my start up screen and other things that I just didn't like. While doing some digging I found Windows drivers for PostgreSQL here. I have since uninstalled the full PostgreSQL and installed the ODBC drivers which, thus far, work great.
To address the original question, after doing a bit more digging I think I found the equivalent ODBC for OS X here. I have not had a chance to try them out, but the concept works very well on Windows 7. I will update this when I get a chance to try them out. Until then, I hope this helps.
All from the above doesn't work for me (OS Catalina 10.15.1)
There was a conflict with classical postgres and homebrew version.
Please delete homebrew version by command
$ brew uninstall postgresql
and then install it from the official website:
$ sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
It is actual for a simple psycopg2 install or django-heroku package.
if you have recently updated python or changed default python (let's say from 3.6 to 3.8). The following code
sudo apt-get install python-dev OR sudo apt-get install python3-dev
will be installing/working for the previous python version.
so if you want this command to work for the recently updated/changed python version try mentioning that specific version like python3.8 in command like
sudo apt-get install python3.8-dev
try above with following
pip install wheel
export PATH=/path/to/compiled/postgresql/bin:"$PATH"
sudo apt-get install libpq-dev
sudo apt-get install python3.x-dev **Change x with your version, eg python3.8**
pip install psycopg2-binary
pip install psycopg2
As I never needed to install postgresql database on this server I installed the following libraries on Ubuntu 14_04 version before running pip install psycopg2 on the same server
apt-get install libpq-dev python-dev
and then executed pip install psycopg2 within virtual env.
Output
Collecting psycopg2
Using cached psycopg2-2.6.1.tar.gz
Building wheels for collected packages: psycopg2
Running setup.py bdist_wheel for psycopg2
Stored in directory: /root/.cache/pip/wheels/e2/9a/5e/7b620848bbc7cfb9084aafea077be11618c2b5067bd532f329
Successfully built psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2-2.6.1
I know you are asking for development environment but if you are deploying on server say, Heroku.
Just add below line in the requirements.txt of your project.
django-heroku==0.3.1
As this package itself will install the required packages like psycopg2 on server deployment.
Try to specify the version and it'll works, do it inside the venv
pip install psycopg2-binary==2.8.6
based on my experience, apt install libpq-dev then try to install psycopg2 inside venv will fix many issues, however for more information you can refer to this link:
https://www.psycopg.org/docs/install.html