Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

won't start after esplora #10

Open
decryp2kanon opened this issue Jun 15, 2020 · 4 comments
Open

won't start after esplora #10

decryp2kanon opened this issue Jun 15, 2020 · 4 comments
Assignees

Comments

@decryp2kanon
Copy link

decryp2kanon commented Jun 15, 2020

version

commit 7c5ce87d226e623b913b0f4c03441534e22ed2b0
Author: volbil <[email protected]>
Date:   Fri Jun 5 19:10:22 2020 +0900

    Fix spent info method

daemon (still syncing)

$HOME/sugarchain/src/sugarchaind -server=1 -rpcuser=rpcuser -rpcpassword=rpcpassword -testnet -txindex=1 -addressindex -spentindex -daemon

error

$ python3 app.py
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from server import config
  File "/root/api-server/server/__init__.py", line 28, in <module>
    from server import esplora
  File "/root/api-server/server/esplora.py", line 101
    return Response(f"start index must be a multipication of {config.tx_page}", mimetype="text/plain", status=400)
                                                                             ^
SyntaxError: invalid syntax

config (testnet)

$ cat config.py 
rid = 'api-server'
cache = 3600  # Cache request for 1 hour
secret = 'PASSWORD'
endpoint = 'http://rpcuser:[email protected]:44229/' # Testnet5
host = '0.0.0.0'
port = 1234
debug = False
block_page = 10
tx_page = 25

whats missing in config?

@decryp2kanon decryp2kanon changed the title crash when starting after esplora support won't start after esplora Jun 15, 2020
@decryp2kanon
Copy link
Author

decryp2kanon commented Jun 15, 2020

update python3.7 on ubuntu 16.04

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.7
$ python3.7 --version
Python 3.7.7

But still error

  • python3.7
# python3.7 app.py
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from server import config
  File "/root/api-server/server/__init__.py", line 1, in <module>
    from flask_socketio import SocketIO
ModuleNotFoundError: No module named 'flask_socketio'
  • python3.7m
# python3.7m app.py
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from server import config
  File "/root/api-server/server/__init__.py", line 1, in <module>
    from flask_socketio import SocketIO
ModuleNotFoundError: No module named 'flask_socketio'

@decryp2kanon
Copy link
Author

Volbil, [15.06.20 14:06]
Try to update alternatives and set python 3.7 as default

Volbil, [15.06.20 14:17]
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2
sudo update-alternatives --config python3
pip3 install --upgrade setuptools
sudo apt-get install python3.7-gdbm
sudo apt install python3.7-dev

Volbil, [15.06.20 14:17]
This is how I usually install python 3.7

cryptozeny, [15.06.20 14:26]
[ Photo ]
pip3.7 confused
pip3.7 install -r requirements.txt

cryptozeny, [15.06.20 14:33]
pip3.7 install --ignore-installed PyYAML fixed

Volbil, [15.06.20 14:34]
You should use virtual enviroment

cryptozeny, [15.06.20 14:34]
[ Photo ]
seems works

Volbil, [15.06.20 14:34]
In this case there is won't be any conflicts

cryptozeny, [15.06.20 14:34]
[In reply to Volbil]
whats that?

Volbil, [15.06.20 14:35]
https://docs.python.org/3/tutorial/venv.html

cryptozeny, [15.06.20 14:38]
install python3.7 on ubuntu 16.04

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2
sudo update-alternatives --set python /usr/bin/python3.7
pip3 install --upgrade setuptools
sudo apt-get install python3.7-gdbm
sudo apt install python3.7-dev

if
you get this error, try pip3.7 install --ignore-installed PyYAML
ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Volbil, [15.06.20 14:40]
[In reply to cryptozeny]
Second part is very wrong!

Volbil, [15.06.20 14:40]
Never do that

cryptozeny, [15.06.20 14:40]
[In reply to Volbil]
PyYAML?

Volbil, [15.06.20 14:40]
[In reply to cryptozeny]
--ignore-installed

Volbil, [15.06.20 14:40]
You should use venv instead

Volbil, [15.06.20 14:41]
python3 - venv venv
source venv/bin/activate

Volbil, [15.06.20 14:41]
In this case all dependencies for api server will be installed into venv folder, instead of globally

cryptozeny, [15.06.20 14:42]
i never installed PyYAML before. it seems default on 16.04

Volbil, [15.06.20 14:42]
[In reply to cryptozeny]
Problem is, you installed PyYAML for python 3.5

cryptozeny, [15.06.20 14:42]
you said 5.1, but in this case pip said 3.11 already installed

Volbil, [15.06.20 14:42]
And update it to python 3.7

Volbil, [15.06.20 14:43]
There is different PyYAML version for 3.5 and 3.7

Volbil, [15.06.20 14:43]
That's why there is conflict

cryptozeny, [15.06.20 14:43]
i removed pip3 requirements, and fresh installed for py3.7

Volbil, [15.06.20 14:43]
And that's why you should use venv

cryptozeny, [15.06.20 14:43]
how to use venv in this case??

Volbil, [15.06.20 14:44]
[In reply to Volbil]
.

cryptozeny, [15.06.20 14:44]
i never tried before

cryptozeny, [15.06.20 14:44]
just this?
python3 - venv venv
source venv/bin/activate

Volbil, [15.06.20 14:44]
Yes

Volbil, [15.06.20 14:44]
And install all dependencies from requirements.txt

@bubasik
Copy link

bubasik commented Jun 15, 2020

Started on ubuntu 16.04

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
alias python3='/usr/bin/python3.7'
python3 -m pip install pip
python3 -m pip install -r requirements.txt

@decryp2kanon
Copy link
Author

crontab

# delete logs
@reboot rm $HOME/.sugarchain/testnet5/debug.log
@reboot rm $HOME/api-server.log
@reboot touch $HOME/api-server.log

# SSL renew by certbot (every Wed at 08:16 AM)
16 8 * * 4 sudo certbot renew --force-renewal >> $HOME/certbot.log 2>&1

# run daemon
@reboot $HOME/sugarchain/src/sugarchaind -server=1 -rpcuser=rpcuser -rpcpassword=rpcpassword -testnet -txindex=1 -addressindex -spentindex -daemon

# run api-server
@reboot /usr/bin/python3 $HOME/api-server/app.py >> $HOME/api-server.log 2>&1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants