How do I install tables module to run? - python

I am trying to run some code written by a collaborator in Python 2 which requires the tables module. I have checked that tables is installed by importing it successfully in a Python 3 shell at the command line but when I do the same for Python 2, there is no module named tables.
All answers I have found so far don't seem to solve my issue, any ideas?
Cheers :)

Try download the package with
pip install tables==3.5.2 -- Python 2
Also, follow this issue on GitHub regarding this at #772
It's not recommended to use python2 as the end of its life on January
1st, 2020, Please consider visiting this documentation Migrating
from PyTables 2.x to 3.x

Use Command - pip install tables
C:\Python27\Scripts>pip.exe install tables
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting tables
Downloading https://files.pythonhosted.org/packages/84/86/34604cfd8e79d23ffef7f1c0ab134ddb98da572d0fcb9cb4631d5b47f549/tables-3.5.2-cp27-cp27m-win_amd64.whl (3.5MB)
|UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 3.5MB 787kB/s
Collecting numexpr>=2.6.2
Downloading https://files.pythonhosted.org/packages/45/d3/5997f8c7d48d4947665c7e7dfaabc3076da85390faf015288e39f242d520/numexpr-2.7.0-cp27-none-win_amd64.whl (106kB)
|UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 112kB 3.4MB/s
Requirement already satisfied: six>=1.9.0 in c:\python27\lib\site-packages (from tables) (1.12.0)
Requirement already satisfied: numpy>=1.9.3 in c:\python27\lib\site-packages (from tables) (1.16.5)
Collecting mock>=2.0
Downloading https://files.pythonhosted.org/packages/05/d2/f94e68be6b17f46d2c353564da56e6fb89ef09faeeff3313a046cb810ca9/mock-3.0.5-py2.py3-none-any.whl
Collecting funcsigs>=1; python_version < "3.3"
Downloading https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Installing collected packages: numexpr, funcsigs, mock, tables
WARNING: The scripts pt2to3.exe, ptdump.exe, ptrepack.exe and pttree.exe are installed in 'c:\python27\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed funcsigs-1.0.2 mock-3.0.5 numexpr-2.7.0 tables-3.5.2
C:\Python27\Scripts>

Related

Unable to import pandas in Replit.com

import pandas
So I am working on a python project and want to import pandas library on https://replit.com/~
For some reasons, it shows some attribute error when I run the project.
Does anyone know ho do I fix or manually install pandas on replit?
Attaching Screenshot of an error herewith.
Usually packages have a lot of errors in replit but you can try this: -
Pandas does actually work on repl.it - you have to install it from the package manager. To do so, click the cube on the side navigation bar and type pandas into the search box. Then click on the pandas search entry and hit the plus sign. Tell me if this works!
Or
Broken package installs can usually be fixed by,
Updating pip and installing pandas from PyPI. By default, Repl.it comes with pip version 19.3.1, but the latest available version for python 3.8 is pip-21.1.1.
~/repl$ pip -V
pip 19.3.1 from /opt/virtualenvs/python3/lib/python3.8/site-packages/pip (python 3.8)
~/repl$ pip install pandas
Requirement already satisfied: numpy>=1.16.5 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from pandas) (1.20.2)
Collecting pytz>=2017.3
Using cached https://files.pythonhosted.org/packages/70/94/784178ca5dd892a98f113cdd923372024dc04b8d40abe77ca76b5fb90ca6/pytz-2021.1-py2.py3-none-any.whl
Requirement already satisfied: python-dateutil>=2.7.3 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in /opt/virtualenvs/python3/lib/python3.8/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
Installing collected packages: pytz, pandas
Successfully installed pandas-1.2.4 pytz-2021.1
Pandas does not work on replit at all, because a lot of modules, which Pandas needs to work properly, do not work in replit. An online Compiler is also not the best choice for doing dataprocessing, it would be better if you install an Interpreter for python on your PC.

Python VS Code imports not working 'No module name requests'

I'm new to python, coming from 6 months of c++ and am also new to VS Code (from VS).
My error is>
Exception has occurred: ModuleNotFoundError
No module named 'requests'
File "C:\Users\ryanb\Documents\Python\main.py", line 1, in
import requests
on anything which begins with :
import requests
this works fine in VS, but I have been encouraged to use Code. When I ran the pip command it said 'satisified'.
PS C:\Users\ryanb\Documents\Python> pip install requests
Requirement already satisfied: requests in c:\users\ryanb\anaconda3\lib\site-packages (2.22.0)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\ryanb\anaconda3\lib\site-packages (from requests) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\ryanb\anaconda3\lib\site-packages (from requests) (1.25.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\ryanb\anaconda3\lib\site-packages (from requests) (2019.11.28)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\ryanb\anaconda3\lib\site-packages (from requests) (3.0.4)
PS C:\Users\ryanb\Documents\Python>
I have anaconda, though I'm new to it as well, but I seem to get the problem either way.
Initially my problem was that it wouldn't find the interpreter but this was resolved after I installed add on files to visual studio (not visual studio code) and used the interpreter which came with that.
Please advise.
Thank you
You may have several python versions installed (e.g. 3.6 32-bit, 3.6 64-bit, 2.7, ...). I would recommend to "natively" install Python from https://www.python.org/ instead of using Anaconda. The problem can happen because VS code is using another Python, different than the one you installed requests. You can verify this if pip3 is installed: try pip3 --version. Anyway, you can change the interpreter VS code is using by clicking the lower bar: screenshot
Or you might just run pip3 install requests.
I would recommend you to leave just one Python installed in your machine.

installing tweepy on Mac using pip - error message

I have recently switched laptops from Microsoft to Apple (2015 MacBook Pro) and I have been installing python libraries such as Nlkt succesfully without any issues.
Now I have been trying to install tweepy and seem to get loads of different error messages.
After trying I pip install tweepy[error message saying "invalid syntax" in my terminal] I did some research on here and tried the below solution:
import pip
>>> package_name='tweepy'
>>> pip.main(['install',package_name])
OSError: [Errno 1] Operation not permitted: '/var/folders/t1/4g62trws5812jb97vvw5kp900000gn/T/pip-yabtGc-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
2
>>>
As you can see it is still not working...
I have also tried sudo pip install tweepy, which came up with this message:
The directory '/Users/MYNAME/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: tweepy in ./Library/Python/2.7/lib/python/site-packages
Requirement already satisfied: six>=1.7.3 in ./Library/Python/2.7/lib/python/site-packages (from tweepy)
Requirement already satisfied: requests-oauthlib>=0.4.1 in ./Library/Python/2.7/lib/python/site-packages (from tweepy)
Requirement already satisfied: requests>=2.4.3 in ./Library/Python/2.7/lib/python/site-packages (from tweepy)
Requirement already satisfied: oauthlib>=0.6.2 in ./Library/Python/2.7/lib/python/site-packages (from requests-oauthlib>=0.4.1->tweepy)
Requirement already satisfied: urllib3<1.22,>=1.21.1 in ./Library/Python/2.7/lib/python/site-packages (from requests>=2.4.3->tweepy)
Requirement already satisfied: idna<2.6,>=2.5 in ./Library/Python/2.7/lib/python/site-packages (from requests>=2.4.3->tweepy)
Requirement already satisfied: certifi>=2017.4.17 in ./Library/Python/2.7/lib/python/site-packages (from requests>=2.4.3->tweepy)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./Library/Python/2.7/lib/python/site-packages (from requests>=2.4.3->tweepy)
When I tried to import tweepy into idle it said "no module named tweepy"
Sorry for my longwinded explanation but I'm getting desperate...
Thank you very much for your help already!!
One solution is to use virtualenv.
In short, virtualenv creates a separate python instance in a folder different from the computers' python installation. This allows for easy installation of packages and helps you manage dependencies better than installing everything globally with pip.
How do I do this?
First, install virtualenv
$ pip install virtualenv
Next, create a virtual environment. The following command will create a python instance in a folder named "foo" in the directory you execute this from.
$ virtualenv foo
Now, whenever you need to install something, use the pip that is located at foo/bin/pip and the python located at foo/bin/python.
$ foo/bin/pip install tweepy
You can test this via the python interpreter:
$ foo/bin/python
Python 2.7.10 (default, Feb 6 2017, 23:53:20)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tweepy
Why would you want to do this?
If you use virtualenv, you are less likely to run into dependency issues.
For example, lets say you make some python program, called ProjectAAA, which uses version 1.1 of LibraryXYZ. A couple months later you want to write a new, completely unrelated python program, ProjectZZZ, which uses version 2.2.5 of that same library. When LibraryXYZ upgraded from 1.1 to 2.2.5, they removed and renamed a few classes and functions that you used in ProjectAAA. So, if you used pip and installed to the main python instance on your Mac, you won't be able to run ProjectAAA anymore, because it depends on version 1.1 but your computer has version 2.2.5.
If you used virtualenv, you could have two separate python instances, each with their own pip and their own package installations. So the environment for ProjectAAA has version 1.1, the environment for ProjectZZZ has version 2.2.5, and both can live peacefully on your computer.
I use OS X and I just successfully installed tweepy on Python IDLE using:
import pip
package_name='tweepy'
pip.main(['install',package_name])
It was pretty easy.
Thanks for the provision; now I can get on with my first extraction.
From looking at your error message, it appears you already have it.
Requirement already satisfied: tweepy in ./Library/Python/2.7/lib/python/site-packages
I tried replicating your issue (in both Python 2.7/3.5) and didn't run in to any issues and was able to import it in to IDLE.
A potential solution could be changing your PATH directory to the one that's listed in your error message.
export PYTHONPATH=$PYTHONPATH:./Library/Python/2.7/lib/python/site-packages
Another thing would be to consider using a virtual environment in the future to ensure that there is no conflict in your package installations.
Further notes: Installing Python on Mac OS X: virtualenv

Error: Failed building wheel for wxpython-phoenix while installing wx

I am trying to install wxpython (I have python 3.5.2(32Bit) and Windows 10(64Bit))
I tried :pip install wx and i get: Failed building wheel for wxpython-phoenix 2 times and then a big error line-->
I also tried installing Anaconda, but it did not help.How can I overcome the problem ?
There's a lot of questions about failed installations on windows, probably because the packages are compiled when installed, and sometimes the compilation fail when the compiler is not properly configured. I admit I decided to let the specialized people handle it.
As a nice workaround, you can grab the already built distribution at the official wxpython website located here:
Python 3.5 32/64 bit windows:
https://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2700+c524ed1-cp35-cp35m-win_amd64.whl
https://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2700+c524ed1-cp35-cp35m-win32.whl
just download the .whl file and do for example:
C:\python35\scripts\pip install wxPython_Phoenix-3.0.3.dev2700+c524ed1-cp35-cp35m-win_amd64.whl
For linux you need to go here first
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/
Then grab your linux version and do the install.
(base) fsdfsdfd#linux:~/Downloads$ pip install wxPython-4.1.1-cp38-cp38-linux_x86_64.whl
Processing ./wxPython-4.1.1-cp38-cp38-linux_x86_64.whl
Requirement already satisfied: pillow in /home/orangel/miniconda3/lib/python3.8/site-packages (from wxPython==4.1.1) (8.1.2)
Requirement already satisfied: numpy; python_version >= "3.0" in /home/orangel/miniconda3/lib/python3.8/site-packages (from wxPython==4.1.1) (1.20.1)
Requirement already satisfied: six in /home/orangel/miniconda3/lib/python3.8/site-packages (from wxPython==4.1.1) (1.15.0)
Installing collected packages: wxPython
Successfully installed wxPython-4.1.1
if does not works, please try this
sudo apt install libwxgtk3.0-gtk3-dev

Python jira is not upgraded by pip

I am using python jira package installed using PIP in a virtual environment. Recently my script started to complain about jira package version:
$ ./my_script.sh
jira/client.py:282: UserWarning: You are running an outdated version of JIRA Python 1.0.3. Current version is 1.0.6.dev20160420173258. Do not file any bugs against older versions.
I tried upgrade using pip like:
$ pip install --upgrade --no-cache-dir jira
Collecting jira
Downloading jira-1.0.3-py2.py3-none-any.whl (46kB)
100% |████████████████████████████████| 51kB 175kB/s
Requirement already up-to-date: requests>=2.6.0 in <...>/.virtualenvs/jira/lib/python3.4/site-packages (from jira)
Requirement already up-to-date: requests-oauthlib>=0.3.3 in <...>/.virtualenvs/jira/lib/python3.4/site-packages (from jira)
Requirement already up-to-date: six>=1.9.0 in <...>/.virtualenvs/jira/lib/python3.4/site-packages (from jira)
Requirement already up-to-date: requests-toolbelt in <...>/.virtualenvs/jira/lib/python3.4/site-packages (from jira)
Requirement already up-to-date: tlslite>=0.4.4 in <...>/.virtualenvs/jira/lib/python3.4/site-packages (from jira)
Requirement already up-to-date: oauthlib>=0.6.2 in <...>/.virtualenvs/jira/lib/python3.4/site-packages (from requests-oauthlib>=0.3.3->jira)
Installing collected packages: jira
Successfully installed jira-1.0.3
I tried to remove installed jira package and install it freshly with same result. Pip always installs only version 1.0.3 but scripts complain about newer version.
My assumption is that 1.0.6 is marked as released (the check is inside the package itself) but not published (I don´t know if this is the right word) for pip to download.
Any clue?
Regards,
JrBenito
It appears there is a 1.0.6.dev20160420173258 version but this isn't being downloaded when using pip install jira. It can be installed by using the workaround found on the issue #156 for this new version. pip install https://pypi.python.org/packages/f6/ea/2535e412ff76d85da20d2be6d1eaf9aa5de49481da94f2fe7e8830eedd35/jira-1.0.6.dev20160420173258-py2.py3-none-any.whl Which it appears you have already commented on, so hopefully they resolve the issue permanently.
I had this same issue, even after specifically downloading the 1.0.6.dev20160420173258 version. When the client.py file gets the version information, it doesn't get the git changeset correctly and so returns 1.0.6 instead of 1.0.6.dev20160420173258.
For now I made a workaround by hardcoding the version number pulled from https://pypi.python.org/pypi/jira/json
In /usr/lib/python2.7/site-packages/jira/client.py:
released_version = "1.0.6" # data['info']['version']
This is admittedly not a fix but lets hope it gets fixed.
It worked for me only after changed it to
/usr/lib/python2.7/site-packages/jira/client.py:
with
released_version = "1.0.6" # data['info']['version']

Categories