Import BioPython in Spyder Py does not work - python

I am installed some modules for python, numpy, biopython, mx.. on my mac (10.10.5). I started the Terminal and tried to import them and it works.
After that I installed Spyder, when I try to import bumpy in Spyder it works but biopython (from Bio import *) does not work -> (ImportError: No module named Bio).
also import mx does not works.
If I start Python in the Terminal the import still works.

Related

ModuleNotFoundError: No module named 'win32.api'

When I tried to import xlwings using import xlwings as xw, it shows the following error:
from win32.api import *
ModuleNotFoundError: No module named 'win32.api'
My environment is:
Windows 10
Python 3.10
IDE: PyCharm
Does anyone know how to fix it?
You probably don't have the pywin32 module installed.
Try pip install pywin32 and check this question

Interactively running Python script in R Studio - how to install a package?

I installed reticulate package. I created Python script in R-Studio
import os
import pandas as pd
Running first line bring Python console >>> and runs fine. The second line generates ModuleNotFoundError: No module named 'pandas'.So I am guessing I need to install pandas (or maybe activate environment, since miniconda is installed) I tried the following in Terminal of R-Studio:
pip
pip3
conda
All of them returned: bash: <relavant_command> command not found...
How can execute this line import pandas as pd
You can use the function py_install from reticulate.
https://rstudio.github.io/reticulate/reference/py_install.html

ModuleNotFoundError: No module named 'pycountry' even though it is installed

I got this error from python ModuleNotFoundError: No module named 'pycountry'.
I imported the module using pip and pip3 and I've also tried running my code in terminal using python, python3, and IDLE.
Why doesn't python recognize the module? I'm receiving the same error about plotly and pandas as well.
import pycountry
import plotly.express as px
import pandas as pd
URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csvā€© '
df1 = pd.read_csv(URL_DATASET)
list_countries = df1['Country'].unique().tolist()
d_country_code = {}
Open your command window and then use this code there.
pip install pycountry
This will install the whole package in your system, so whenever you import the module, it will not show an error.
This worked for me, I was facing the same issue while using it in Jupyter Notebook.
If you want more information please visit this page.
If you have Anaconda, try:
conda install -c conda-forge pycountry

Exporting Python 3.5 and Tkinter to EXE or MSI

I'm using Python 3.5 and would like to export my python code for me to send to others who do not have Python installed. Thing is Pyinstaller doesn't work as I get this error:
CX_Freeze also doesn't work for me either as Tkinter still presents a problem, on running python setup.py build I get:
KeyError: 'TCL_LIBRARY'
I'm getting sick of this to be frank so any help would be appreciated. Here's my imports in my code if it helps
import pdb
from tkinter import *
from tkinter import filedialog
import tkinter.messagebox
from datetime import datetime, date, timedelta
import pandas as pd
import numpy as np
from xlsxwriter.utility import xl_rowcol_to_cell
If you are using an older version of cx_Freeze(<5.0), it doesn't have Python35 support. The latest development version has Python35 support. You can install it by
pip install cx-Freeze-win
But you need to have VC++ run-time installed on your system to run this successfully.
Also I've found this GitHub-repo with pre-built binary packages of cx_Freeze 5 for windows platform.
pip install wheel
https://raw.githubusercontent.com/sekrause/cx_Freeze-Wheels/master/cx_Freeze-5.0-cp35-cp35m-win_amd64.whl
Well I managed to get it working by downloading Pyinstaller from the website and running the commands in the new folder. I followed the steps in this answer here.

iPython ImportError: No module named display

Trying to run python script but can't find module IPython.display.. Seems like it would be something simple but I can't find an answer anywhere!
/vagrant/dreamify.py in <module>()
4 import scipy.ndimage as nd
5 import PIL.Image
----> 6 from IPython.display import clear_output, Image, display
7 from google.protobuf import text_format
8
ImportError: No module named display
According to the IPython's repository, the IPython.display module was added in commit 5462c7e, and it was released with IPython 0.13.
I think you have an older version of IPython.
You can check the IPython version with ipython --version.
It can be upgraded with pip install --upgrade IPython.
In Pycharm import module ipython. In Pycharm go to preferences and then project interpreter. Click on the "+" sign then search ipython and install package.

Categories

Resources