I need to be able to run JupyterLab on the Python executable in SPSS in order to import some SPSS libraries (spss, spssaux, SpssClient, etc.) in a notebook in JuptyerLab. Based on answers to other Ancadonda/executable-related questions, I've attempted two possible solutions:
Paste the relevant libraries from the Python directory in SPSS to the Python directory in Anaconda. I tried this both to the base environment and to the virtual environment I work out of, and tried launching JupyterLab both from the base and from the virtual environment. I copied the files from C:\Program Files\IBM\SPSS\Statistics\27\Python3\Lib\site-packages to C:\ProgramData\Anaconda3\Lib.
Redirect Anaconda to the Python executable in SPSS. I tried to to do that with sys.path.insert:
import sys
sys.path.insert(0, 'C:\Program Files\IBM\SPSS\Statistics\27\Python3')
Attempt #1 results in the following error when I try to import spss:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11344/2864419669.py in <module>
----> 1 import spss
C:\Program Files\IBM\SPSS\Statistics\27\Python3\Lib\site-packages\spss\__init__.py in <module>
254 __SetErrorMessage()
255
--> 256 from .spss import *
257 from .cursors import *
258 from .pivotTable import *
C:\Program Files\IBM\SPSS\Statistics\27\Python3\Lib\site-packages\spss\spss.py in <module>
21
22 import atexit,os,locale,sys,codecs
---> 23 from . import PyInvokeSpss
24 from .errMsg import *
25
ImportError: DLL load failed while importing PyInvokeSpss: The specified module could not be found.
This in spite of having copied PyInvokeSpss to C:\ProgramData\Anaconda3\Lib.
#2 doesn't seem to change the path to the executable:
C:\ProgramData\Anaconda3\python.exe
I also have an idea for a third solution, which would be to package the Python that's in SPSS as an iPython kernel, and then activate that in JupyterLab after it's launched, but I can't figure out a way of doing that.
What's the best direction here for a solution? What am I doing wrong?
This question has been asked a few times, but the remedy appears to complicated enough that I'm still searching for a user specific solution.
I recently installed Quandl module using pip command. Even after successful installation my python idle is still showing
Traceback (most recent call last):
File "F:\Python36\Machine Learning\01.py", line 3, in <module>
import Quandl
ModuleNotFoundError: No module named 'Quandl'
I have used import command in my code.
I am using python 3.6.1 version.
I am working on a windows 10 Desktop.
I have also tried re-installation of module.
You can better navigate to your python scripts folder and open a command window there and try pip3 install quandl .Hope this helps.
I am new to python and anaconda.
I am using Python 3.5.1 |Anaconda 4.1.0 (64-bit)| (default, Jun 15 2016, 15:29:36) [MSC v.1900 64 bit (AMD64)]. The version of the notebook server is 4.2.1.
When I issue the following command
import tweepy
it runs successfully.
But when I try to run the following command
%%file test.py
import tweepy
Its getting save as test.py
When I issue the following command
!python test.py
I am getting the following error.
Traceback (most recent call last):
File "test.py", line 2, in <module>
import tweepy
ImportError: No module named tweepy
I am able to see tweepy folders in my anaconda installation directory
D:\Anaconda3\Lib\site-packages
tweepy-3.5.0.dist-info
tweepy
Where am I going wrong. Kindly guide me.
Thanks.
Since I have multiple versions of python installed on my machine this issue exists. So when I point to the correct directory of my python installation, its working fine.
Python 3.5 on Windows 10, 32-bit box; all I want to do is run this:
import quandl
import pandas as pd
import html5lib
import lxml
# retrieve web page with list of 50 states
fiddy_states = pd.read_html('https://simple.wikipedia.or /wiki/List_of_U.S._states')
But for the life of me I can't seem to get a properly installed lxml, which is required by pd.read_html. Following advice from several online sources I have MinGW installed in my system and I have also added the following to C:\Python35-32\Lib\distutils\distutils.cfg:
[build]
compiler=mingw32
I have MinGW installed and included in PATH. I have tried installing lxml using both pip3 as well as the binaries found at Unofficial Windows Binaries for Python Extension Packages.
Here's all installed packages:
['beautifulsoup4==4.4.1', 'cffi==1.6.0', 'cryptography==1.3.2', 'cycler==0.10.0', 'cython==0.24', 'html5lib==0.9999999', 'idna==2.1', 'inflection==0.3.1', 'lxml==3.4.4', 'matplotlib==1.5.1', 'more-itertools==2.2', 'ndg-httpsclient==0.4.0', 'numpy==1.11.0', 'pandas-datareader==0.2.1', 'pandas==0.18.1', 'pip==8.1.2', 'pyasn1==0.1.9', 'pycparser==2.14', 'pyopenssl==16.0.0', 'pyparsing==2.1.4', 'python-dateutil==2.5.3', 'pytz==2016.4', 'quandl==3.0.1', 'requests-file==1.4', 'requests==2.10.0', 'scikit-learn==0.17.1', 'setuptools==18.2', 'six==1.10.0']
As shown above, lxml==3.4.4 appears to be installed, however when I try to run the line containing pd.read_html I get the following error message:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\Jose Manuel\AppData\Local\Programs\Python\Python35-32 \lib\site-packages\pandas\io\html.py", line 874, in read_html
parse_dates, tupleize_cols, thousands, attrs, encoding)
File "C:\Users\Jose Manuel\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandas\io\html.py", line 726, in _parse
parser = _parser_dispatch(flav)
File "C:\Users\Jose Manuel\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandas\io\html.py", line 685, in _parser_dispatch
raise ImportError("lxml not found, please install it")
ImportError: lxml not found, please install itenter code here
Your help is very much appreciated
I have been struggling with this today. I found, elsewhere on stackoverflow.com, this two-part and quick solution, which resulted in python no longer complaining when I tried to use lxml:
go to this repository and download a version which matches your Python installation (the version number, and 32- vs 64-bit. I use Python 3.5.1 64-bit, installed on Windows 10, so on that page, I chose lxml-3.6.0-cp35-cp35m-win_amd64.whl. You say you have 32-bit Python, so use a version that matches that (like lxml-3.6.0-cp35-cp35m-win32.whl.
My download directory is d:\Downloads. Python must be in your PATH environment variable for the next step to work. Use a command like the following, changing "D:\Downloads" to the pathname to your download directory. Then, at a DOS prompt, type:
python -m pip install "D:\Downloads\lxml-3.6.0-cp35-cp35m-win_amd64.whl" lxml-3.6.0-cp35-cp35m-win_amd64.whl
I am having an issue importing the client module after installing the pywin32 extension for windows. I can import win32com with no issues at all, but I recieve an error when I try importing the client module. I realize this question has been asked numerous times, but here is what I have tried:
I have installed and reinstalled the correct version of pywin32. I have Python version 3.5 (32 bit) and I have installed the 3.5 32 bit file.
I have updated my PATH variable and my PYTHONPATH variable to include the locations of both the win32com and the client module.
I've manually ran the postinstall win32com script (not sure what this would do but I've read that it has helped some people)
It is worth noting that I can import sys, os, win32com, and win32com.client in the python IDLE, but when I run the import from a script in the same format, Python tells me it can't find the win32com.client module.
I receive the following error when running the win32com.client import from a script:
Traceback (most recent call last):
File "C:\Users\10023539\Desktop\pyscripts\outlook.py", line 3, in <module>
import win32com.client
ImportError: No module named 'win32com.client'; 'win32com' is not a package
I'm not sure what else to try at this point, any help would be greatly appreciated.