꿀팁 분석 환경 설정(121)
-
mpi4py 설치 에러 해결하기
OS : ubuntu16.04 RROR: Command errored out with exit status 1: command: /opt/conda/envs/rl/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4q1x2alw/mpi4py_d44b5798f89d40429ac785557052b8ca/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4q1x2alw/mpi4py_d44b5798f89d40429ac785557052b8ca/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f..
2021.03.28 -
Library "GLU" not found 해결 방법
에러가 나서 찾아 보니, 다음과 같은 해결책을 찾아서 공유한다 OS : ubuntu16.04 sudo apt-get update sudo apt-get install freeglut3-dev www.devmanuals.net/install/ubuntu/ubuntu-16-04-LTS-Xenial-Xerus/how-to-install-freeglut3-dev.html How to install freeglut3-dev On Ubuntu 16.04 Lts? Uninstall and remove freeglut3-dev Package Quick installation of freeglut3-dev: Step 1: Update system: sudo apt-get update Step 2: Install: fre..
2021.03.28 -
memory profiler 를 활용해서 메모리 사용량 확인하기
목차 패키지 설치 pip install memory_profiler 실행방법 memory profiler를 작동하려면 다음과 같이 한다. python script가 종료되어야 가능하다. python -m memory_profiler test.py memory profiler를 logging 하려면 다음과 같이 하면 된다. logging은 다음과 같이 하면 된다. python -m memory_profiler test.py > ./log.txt @profile로 지정하여야 그 부분에 대해서 확인이 된다! # imports from memory_profiler import profile import requests class BaseExtractor: # decorator which specifies whi..
2021.03.05 -
[Python] python modules import 하는 3가지 테크닉
towardsdatascience.com/3-advance-techniques-to-effortlessly-import-and-execute-your-python-modules-ccdcba017b0c 3 Techniques to Effortlessly Import and Execute your Python Modules How to Make your Python Modules User Friendly towardsdatascience.com 1. Import Everything Scenario utils.py에 있는 모든 함수와 클래스를 불러오기 def add_two(num: int): return num + 2 def multiply_by_two(num: int): return num * 2 a = 5..
2021.03.02 -
VSCode에서 Google Colab GPU Runtime 접속하기
아래 블로그를 참고해서 하나씩 직접 진행중... Steps: First, you need to have a cloudfare binary file. You can download it for your corresponding operating system from here. Follow all the instructions given here to install it. Once cloudflared is installed, you will have a binary(.exe) file after extracting the package. Copy the exact path to the binary file. For example, in my case it is in C drive, so I will wri..
2021.03.01 -
[vscode] pylance extenstion 사용할 때 발생하는 import [user library] could not resolve 해결하기
"완벽한 해결책은 아니라는 것을 먼저 말씀드립니다." 파이랜스(Pylance)는 마이크로소프트의 기존 파이썬(Python) 확장 기능과 연동돼 파이썬 개발자에게 더 빠른 타입 검사 및 프로그램 분석을 제공한다. pylance를 사용하면 개발자가 좀 더 빠르게 개발할 수가 있고, 여기에 Error Lens라는 extensions까지 같이 사용하면 더 좋다! 예를 들어 이런 식으로 vscode에서 error를 아주 잘 보여줘서 디버깅하기가 쉬워진다. 근데 여기서 발생한 문제가 있다. pylance를 사용했을 때 사용자가 따로 개발한 script는 잘 적용이 안되는 이슈가 있었다. 나 같은 경우에는 src --> data ---------> test train --> train ---------> train...
2021.02.12 -
[vscode] python 및 git 관련 Extention 찾아보기
vscode에서 python 관련해서 유용한 extension 찾아보기 extension 빈도 1. Python 2 2.Bracket Pair Colorizer 3 3. Better Comments 2 4. Error Lens 5. Git Graph 6. GitLens Git supercharged 7. Python Preview 2 8. Bookmarks 9. TODO Highlight 10. Python Indent 2 11. TabNine 12. Indent-Rainbow 2 13.Python Snippets 14. autoDocstring Reference dev.to/ritulsingh/my-top-10-visual-studio-code-extensions-for-python-in-2020-l3..
2021.02.10 -
[jupyter notebook] auto save interval 변경하기
그냥 하는 방법은 아래와 같다. %autosave n medium.com/nabla-squared/how-to-change-the-autosave-interval-in-jupyter-notebooks-2ab996fe4446 How to change the autosave interval in Jupyter Notebooks You can use this Jupyter extension medium.com 실제로 왜 저장 시간을 바꿔야 하는지는 잘 모르겠다. 메모리 때문일지 아니면 머 때문일지는 모르겠지만, 혹시 필요한 경우가 있을 수도 있으므로 기록
2021.01.16 -
[Ubuntu] Jupyter notebook 부팅시 자동 실행 예시
jupyter notebook 설치하고 나서를 가정합니다 vi 편집기를 사용해서 서비스 생성 sudo vi /etc/systemd/system/jupyter.service 서비스 생성에 다가 아래와 같이 작성하기 [Unit] Description=Jupyter Notebook Server [Service] Type=simple PIDFile=/run/jupyter.pid User=srlee ExecStart=/home/srlee/anaconda3/bin/jupyter-notebook ## 이쪽 상황에 맞게 바꿔야 함. WorkingDirectory=/home/srlee/notebook ## 이쪽 상황에 맞게 바꿔야 함. [Install] WantedBy=multi-user.target systemctl ..
2020.12.27 -
[Ubuntu] Pycharm 설치 및 아이콘 만들기
파이참 설치 심볼릭 링크(symbolic link) 생성 (root 계정 필요) (다운로드 한 경로를 찾으시면 됩니다.) (저는 /home/srlee/다운로드/pycharm-community-2020.3.1/ 에 저장을 했습니다. ) ln -s /home/srlee/다운로드/pycharm-community-2020.3.1/bin/pycharm.sh /usr/bin 링크 연결 후 applications에 pycharm 파일 생성 vi /usr/share/applications/pycharm.desktop 파일 생성하고 아래와 같이 작성 Icon 같은 경우 경로에 맞게 잘 해주기 (다운로드 한 경로로 설정) [Desktop Entry] Name=Pycharm Comment=Pychar Integrated D..
2020.12.27 -
[TIP] 에러 발생할 때 Logging 파일 생성 및 적재하는 코드
파이썬에서 클래스로 짜거나 함수로 짜거나 하였을 때, 중간에 에러가 발생하는 경우가 있다. 이것들을 따로 로깅을 하지 않고 주피터 노트북에서 계속 돌린다면, 실수로 노트북이 꺼졌을 때나 잘 찾을 수가 없게 된다. 그래서 이번에는 함수나 클래스에서 에러가 발생했을 때 로그를 적재하는 파일 생성 및 계속해서 적재하는 코드를 만들어 봤다. 예를 들어 아래 함수처럼 divide라는 나눗셈 함수를 만들었는데, 들어오는 데이터에 따라서 에러가 발생하는 경우가 있다. 이때 어떠한 a 와 b 였으며, 무슨 에러인지를 표현하는 것을 공유한다. @log_error("./log.txt") def divde(a,b) : return a/b 아래가 풀 코드이다. 이 함수를 통해서 로그를 생성 및 argument를 적재하여 확인..
2020.11.15 -
[TIP] HTML 을 PDF로 변경해주는 사이트 공유
주피터 파일을 ipynb를 pdf로 그냥 하게 되면 에러가 발생한다. 그래서 추가적으로 뭔가를 따로 설치를 해야 하는데, 잘 안될 때가 있었다. 그래서 차잗 html을 pdf로 쉽게 웹사이트로 변경할 수 있는 것을 찾게 되어 공유한다. www.sejda.com/html-to-pdf Sejda.com - Helps with your PDF tasks Easy, pleasant and productive PDF editor. Split, merge or convert PDF to images, extract pages, alternate scans and many more. www.sejda.com
2020.11.09