Search this site

Friday, April 19, 2019

pip error main(?)

I just upgrade my pip in raspdebian and I got this error when I run pip

Error message

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in
    from pip import main
ImportError: cannot import name 'main'

I already tried to reinstall pip from apt but it didn't solve the problem

In the end, I found something

type in terminal
nano  /usr/bin/pip
that will open pip file like this
import sys
from pip import main
if __name__ == '__main__':
     sys.exit(main())

1. Change "from pip import main" to "from pip import __main__"
2. Change "sys.exit(main())" to "sys.exit(__main__._main())"

The result is like this
import sys
from pip import __main__
if __name__ == '__main__':
     sys.exit(__main__._main())
exit nano and save

and you can use your pip again

Sunday, February 3, 2019

Change phpmyadmin's URL in ubuntu

A few years ago I put some note for windows here
and now I will make one for ubuntu

So for example, I want to change my phpmyadmin link
default: 127.0.0.1/phpmyadmin and I want to change it to 127.0.0.1/myownlink

we need to change 1 setting in apache2
sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf
change the alias
Alias /phpmyadmin /usr/share/phpmyadmin
to
 Alias /myownlink /usr/share/phpmyadmin

then we need to activate and restart apache2 (maybe only restart apache2 will do it)
 sudo a2enconf phpmyadmin.conf
 sudo systemctl reload apache2.service

done yey \o/ 

MySQL in ubuntu 18.04 (update)

It was a long time ago, I make a post (or my personal note) about how to install MySQL in ubuntu
and it seems now, the version and how to install is already changed so I make this post.

previous post here

Step:
0. apt get update (start with this)
sudo apt-get update
1. Installing MySQL
sudo apt-get install mysql-server
1.1. mysql secure installation (optional but recommended)
sudo mysql_secure_installation
2. Installing apache2
sudo apt-get install apache2
3. Installing phpmyadmin
sudo apt-get install phpmyadmin
4. connect apache2 and phpmyadmin
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
5. activate it
sudo a2enconf phpmyadmin.conf
6. restart apache
sudo systemctl reload apache2.service

ok done

Wednesday, September 12, 2018

Arduino nano suddenly get error: avrdude: stk500_getsync() (Solved)

I am still new in arduino things
I use the arduino IDE from windows store with auto update on.

So basically what happen is like this:
My PC using Arduino IDE v1.8.5 because I never close that window so it never update.
And then when I try to upload a program from my laptop which is use Arduino IDE v1.8.7, I got these error

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x53
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x65
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x74
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x75
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x70
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x50
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x44
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x0d
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x72
An error occurred while uploading the sketch
After doing some googling (thanks Mr. google), I found out that this error means that you computer has connection problem with your arduino, meanwhile I didn't do anything since the last time.

The same error happened after I update my IDE in my PC from v1.8.5 to v1.8.7

Finally, I found out that I used the wrong processor
So basically there are update in bootloader of nano and I need to use the ATmega328(Old Bootloader) instead of ATmega328

And that fix all my connection problem
I hope this can help, for someone who still use the old nano bootloader

Thursday, May 31, 2018

Install Jupyter in windows 10

As my previous diary is about jupyter here

so now I will make a note how to install jupyter in windows 10 (my current OS)
I assume you already have anaconda installed

To install jupyter we need to do this step
python  -m pip install jupyter

I think it will be the same in linux, but I haven't try it yet

pip install jupyter
And done


Then after that you can run it by type
jupyter notebook
on you command prompt

It will open http://localhost:8888/ in your browser