adding 'PyLit' pure python module on OS X - macos

I'm trying to add a module to my PYTHONPATH permanently, I know this could sound like a duplicated question, but I tried all the solution that i could find.
what I want to do is:
add PyLit module (https://github.com/gmilde/PyLit) to my PYTHONPATH permanently.
the instructions to install it are:
Install
As PyLit is a pure Python module, installation is straightforward: Put pylit.py in Python's Module Search Path.
I need this module to be added permanently. I tried:
adding it in my .bash_profile in my $PATH
creating in my .bash_profile a $PYTHONPATH new var
adding it to my: /Library/Python/2.7/site-packages
tried using Anaconda (and pip)
I'm a newbie with Python, but I have given a look at the module I want to add, and the structure seems weerd, usually I use a setup.py file but it is missing.
python setup.py install
I hope someone can help me out...
Thanks

I just solved my issue... There were conflicts between ma python versions. I basically removed python 2.7 and reinstalled it.
Then I tried again with the pip approach and, after rebooting my mac book pro, everything worked just fine.

Related

Jupyter can't find my packages, how can I connect my kernel to the pip destination folder?

first time on stack overflow. Basically pip is installing packages and Jupyter notebook can't find them to import. I've searched other similar questions and found some tips, but none of them have worked in my particular instance. I've shown the information that was helpful in other posts so you can see what I' mworking with:
My Notebook
In similar questions they've asked what "jupyter kernelspec list" returns in the terminal, so I've inlcuded that here:
KernelSpec Results
I would include my kernel.json file as well, but I tried changing with it, and upon seeing no change, tried deleting it altogether and my notebook runs fine.
So I'm thoroughly confused, and could really use some help.
Thankyou
Make sure the packages you think you installed are really installed to the running environment.
E.g. from inside notebook run:
!pip list | grep package_name
If the package in question is installed, get details using [pip show][1]
!pip show pyyaml
Name: PyYAML
Version: 5.1
Summary: YAML parser and emitter for Python
Home-page: https://github.com/yaml/pyyaml
Author: Kirill Simonov
Author-email: xi#resolvent.net
License: MIT
Location: /home/ntg/anaconda3/lib/python3.7/site-packages
Requires:
Required-by: bokeh, anaconda-client
Remember that for some libraries the import is not the name of the module,e.g. to install pyyaml I did pip install pyyaml, but to import it I will need import yaml... When in doubt, google the specific module.
Keep in mind that pip deals with modules (think libraries such as pandas).
If you cannot find some of your code, make sure it is in the directory you think it is, if not in the same directory, make sure the other directory has a file named init.py to denote the dir is a module, and possibly check
Cannot import from __init__ in a subfolder

comtypes.gen attributes are different from self download and conda pre-installation

I have created my own Anaconda environment. I needed to use the 'comtypes' package to connect to the software ETABS, so I first downloaded it with the conda installation command and then I tried the next command line:
helper = comtypes.client.CreateObject('ETABSv17.Helper')
But, I received the next error:
AttributeError: module 'comtypes.gen.ETABSv17' has no attribute 'cHelper'
However, I realized that if a try the same command line with the base environment coming with Anaconda, that includes a pre-installed 'comtypes' package, there is no problem. In fact, if I check comtypes.gen.ETABSv17 with my customized environment and with the one from Conda, there is a huge difference between available attributes, even when they have the same version number: comtypes 1.1.7.
How can I get the exactly same 'comtypes' package that comes with Anaconda in order to have all the associated attributes working? Maybe, could there be some package dependence that I am missing?
Pd: I am using Windows10 and I have tried it in Pycharm and Spyder with Python 3.7
Thank you all !
I had this issue and i was using python 32 bit version. So uninstalled and installed a 64 bit version and now its working fine. May be this helps

Theano is missing modules

I am on windows 64bit, I have installed anaconda, and managed to create an environment with python 2.7
I have numpy, pylearn2, theano, and every package is built properly
I have been able to import all these modules, however I get some very esoteric messages when I try to complete the model, like
ImportError: Could not import pylearn2.models.softmax_regression but could import pylearn2.models. Original exception: No module named dnn
Then I tried to actually find the package in the installation, but inside the cuda folder, there is no module named dnn. Looking at github, I see that it should be there.
Why is theano missing modules? I installed using conda install theano, and it gave some suggestions, I have managed to pick the correct one.
I have uninstalled and installed theano many time, I can import it but I can never get the proper modules.
What is going wrong?
Ok, after a few days of search, it seems like Theano installed from anaconda is missing a lot of modules. However, installing theano by cloning the repository with
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
seems to resolve the issue. Since windows normally does not have git, it can be easily installed (seems to take care of the environment's path variable) from here
https://git-scm.com/download/win

How to install Pygame on Portable Python 3.2.5.1

I know that similar- questions about installing modules in Portable Python have been
asked but I have looked at all of them and another website. I didn't have success.
For me, I wanted to install Pygame on Portable Python 3.2.5.1 (on a memory stick). I nearly
managed to install it successfully but when I typed import pygame into the shell window,
there was a weird error in one of the files, displayed in the shell. See image below:
Update: Portable Python at time of writing has been discontinued (not being developed anymore)
and there are other alternatives available in suggested links on their website or internet search
engine query results. I have managed to add the Pygame Python module to my version
of one of these continuing projects so this question is not of use to me anymore.
I had this same problem today. I may have managed it. This is what I did:
I installed pygame to an empty folder so I could see all the things it needed. this was two folders:
Include>pygame and
Lib>site-packages
I went to Lib>site-packages and copied all the things there, then pasted them into
G:\Portable Python 3.2.5.1\App\Lib\site-packages
I also copied all the things in:
G:\Include\pygame
and pasted them into:
G:\Portable Python 3.2.5.1\App\include
from a quick play, this seems to work.
Although it isn't really the proper answer I was looking for a while ago when I posted the question (how to install Pygame on Portable Python 3.2.5.1), I have a possible answer for my question that could work.
It is possible (although I haven't personally tested it yet) run a Python
program using Portable Python and with the Pygame library folder stored in the directory the program is stored in. Python's module search path includes the current directory (of the running file) so import pygame would import it.
This question is old and maybe this is a possibility that was not possible at this time but simply:
From a command prompt go to your Portable Python's python.exe folder with cd <path to Portable Python>\App\Python,
Run: .\python.exe -m pip install pygame,
Now you have pygame module installed, you can check in your <path to Portable Python>\App\Python\Lib\site-packages that you have now pygame.
Note: I used Portable Python from here, version 3.10.5 at the time I wrote this.

Full installation instruction of youtube-dl in windows

I have just downloaded the youtube-dl-2014.07.15.tar_2.gz in my windows. At first I want to tell I don't know anything about python. And I already have installed python 2.7. Can anyone give me instruction to execute these scripts?
I have already tried to run...but there is some error like these. "No mudule named youtube-dl"
I want a fresh start. Now I am using windows 8.1 and I have also tried youtube-dl.exe. And there is also problem like screenshot
If I want to get worked both script and program what will I do?Any helps will be appreciated. If you give me instruction from scratch that will be better.
To install youtube_dl in Python on Windows (command from their github):
Tested with Python 3.9 on Windows 10
pip install --upgrade youtube-dl
Now when using it, notice that the name of the Python module is with an underscore.
Because it is a Python module, use it like so:
py -m youtube_dl <video url>
Of course video url is the video you want to download
This seems to be caused by a limitation of py2exe. You may want to file a youtube-dl bug report for moving to a cxfreeze, which should not have that problem. In any case, simply moving the youtube-dl.exe file into another directory such as C:\Users\Shamim should fix the problem.
you need just to put the youtube-dl.exe file in in your home directory or any other location on your PATH.
You can see your PATH in your "Envirenment Variables"

Resources