Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Thursday, October 25, 2018

macOS Mojave doesn't recognize git



Who doesn't want dark mode on mac!

However, after updating the macOs to Mojave, if you try to access git on your command prompt, it throws below error -

$ git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun


All you need to do is reinstall the xcode command line tool using following command -

$xcode-select --install

It should run fine after that.

Sunday, June 11, 2017

Instaling TensorFlow on mac OSX Yosemite


I wanted to try out TensorFlow, so I started with the installation steps. First create virtualenv, and then try to do pip install, there are bunch of different ways you can install as per the instructions provided here, though I went with below and it at least for the first part installed it right.

pip install --ignore-installed --upgrade \ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.1.0-py2-none-any.whl

Above is CPU-only installation with Anaconda. My mac default python runs under anaconda, so above worked well for me compared to other installation mechanism described in documentation.

After the installation I followed below step to try out test of tensorflow installation success -

$ python
>> import tensorflow as tf

Though I ran into error -
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 
ImportError: numpy.core.multiarray failed to import

It was because of the numpy, it was pointing to the wrong one. I tried below to check the path of numpy -

$ python
>> import numpy
>> print numpy.__path__
['/usr/local/lib/python2.7/site-packages/numpy']

Which is an issue, as its using /local/lib/python2.7 installation and not local virtualenv installation -
Go to the path and remove the file explicitly. After that I tried again to review the path of numpy -

>> print numpy.__path__
['/Users/jpatel/Apps/tensorflow/venv/lib/python2.7/site-packages/numpy']

However, at this point I run into another error -

    from google.protobuf import descriptor as _descriptor
ImportError: No module named protobuf

Its because of issue with protobuf installation version, after looking at few of the online documentation help,  I updated to below -

$ pip uninstall protobuf
$ pip install protobuf==3.0.0a3

though error continues, 

    from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2
ImportError: cannot import name any_pb2


so figured another version from online help -

$ pip install --upgrade protobuf==3.0.0b2


After that it started working fine. -

>>> import tensorflow as tf
>>> hello = tf.constant("Hello, TensorFlow")
>>> sess = tf.Session()
2017-06-11 09:45:35.310965: W t
>>> print(sess.run(hello))
Hello, TensorFlow

>>> node1 = tf.constant(3.0, tf.float32)
>>> node2 = tf.constant(4.0)
>>> print(node1, node2)
(, )


If I do more experimentation around it, will share more examples and issues I run into and how to solve..

Tuesday, August 28, 2012

Project Planning tools on mac

Project Planning Tools on Mac:

  • 3D Timelines
  • Easy Timelines
  •  Merline (tool)
  •  Free
OmniPlan - http://www.omnigroup.com/products/omniplan/
  • Change Tracking
  • Publish Subscribe
  • Smart Scheduling
Gantter - https://app.gantter.com/
  •  Online project planning integrated with google docs
Though give this many options, people still preferes Microsoft Project for project planning. Feel free to suggest if you come across any other project planning tool on mac.
-        

Sunday, July 15, 2012

Django Application Image issues while running on mac

If you are using django and getting jpg adapter error on image upload or while running the app on rendering the jpeg image, in that case follow below instructions. The error is most likely because of installation of jpeg in environment.


You have to install support for JPEG, for example in mac use homebrew for installation and follow below instructions - 

1. Uninstall PIL
    sudo pip uninstall PIL

2. Install JPEG
    brew install jpeg

3. Install PIL again
    sudo pip install PIL

for ubuntu users use below command -
sudo apt-get install libjpeg62-dev

Saturday, February 18, 2012

VIM editor line numbering

If you are fan of VI editor, here is the trick how you can enable the line numbering,

below is your normal presentation when you do vi


#define your item pipelines here
from scrapy.exceptions import DropItem
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/topics/item-pipeline.html

class newsPipeline(object):
    def process_item(self, item, spider):
...........

1. hit esc
2. enter - :set rnu

result -

  0 #define your item pipelines here
  1 from scrapy.exceptions import DropItem
  2 # Don't forget to add your pipeline to the ITEM_PIPELINES setting
  3 # See: http://doc.scrapy.org/topics/item-pipeline.html
  4
  5 class newsPipeline(object):
  6     def process_item(self, item, spider):

  7 ......

if you want to revert to the original settings..
1. hit esc
2. enter - :set nornu


Sunday, February 12, 2012

Some Useful mac commands


  • Check the disk space - df 
  • Is your system 32-bit or 64-bit - uname -a
  • Update environment variables like windows - vi ~/.bash_profile
  • Load the environment variables - source ~/.bash_profile
  • Run program under admin - sudo



In mac, there is no explicit delete button like windows.

Fn + backspace - "del" key (delete letter to the right)
Alt + backspace - Delete last word
Command + backspace - Delete whole line